http://www.ols.es/exim/dlext/ Some useful dlfunc functions for Exim ip2country Get country from reverse dns country tld or from MaxMind GeoIP http://www.maxmind.com/app/geoip_country if not possible (minimizes GeoIP outdated database records). Requires GeoIP C API http://www.maxmind.com/app/c Usage: ${dlfunc{/usr/local/exim/exim-ext.so}{ip2country}{$sender_host_address}} returns: 2 letter iso code for given ip address or "--" if not found. get_env Return given enviroment variable content. Usage: ${dlfunc{/usr/local/exim/exim-ext.so}{get_env}{PATH}} returns: enviroment variable content "" if not found. pipe_message Runs program injecting current message or file into it's stdin and returning the stdout output. Usage: ${dlfunc{/usr/local/exim/exim-ext.so}{pipe_message}{app}{file}} If {file} is ommited, the current message is piped to the application. returns: application stdout output. DSpam usage example:: # the trick here is to call dspam in deliver=summary mode, which will # return only the dspam header, so you only need to add this header # to the message (no need to reinject it): warn set acl_m13 = ${dlfunc{/usr/local/exim/exim-ext.so}{pipe_message}\ {/usr/local/bin/dspam --deliver=summary --client \ --mode=teft --user global}} set acl_m14 = ${extract {result}{$acl_m13}} set acl_m15 = ${extract {signature}{$acl_m13}} # now you get in acl_m13 the dspam header, the signature in acl_m15 # (if you need it for logging or something else) and the result # in acl_m14 # you could optionally retrain it if it comes from a very trusted sender: warn condition = [VERY TRUSTED SENDER] condition = ${if match {$acl_m14}{Spam}} set acl_m13 = ${dlfunc{/usr/local/exim/exim-ext.so}{pipe_message}\ {/usr/local/bin/dspam --user global --client \ --class=innocent --source=error \ --deliver=summary --signature=$acl_m15}} set acl_m14 = Innocent (retrained) set acl_m15 = # deny at SMTP time if it's spam: deny condition = ${if match {$acl_m14}{Spam}} message = Spam not welcome # and if accepted add the proper header so it could be latter retrained # if need: warn condition = ${if def:acl_m14} add_header = $acl_m13 This enables exim to run dspam and add the result header to the message (both at data acl or at transport/router time) without having to run ugly transports which reinject the message again into exim. surbl Scans file for url's and test found urls against SURBL http://www.surbl.org/ and URIBL http://www.uribl.com/. Has to be run in mime ACL. Requires libCURL http://curl.haxx.se/libcurl/ Usage: ${dlfunc{/usr/local/exim/exim-ext.so}{surbl}{file}} returns: surbl result example:: warn set acl_m9 = 0 decode = default warn condition = ${if eq{${lc:$mime_content_type}}\ {text/plain}} set acl_m9 = ${dlfunc{/usr/local/exim/exim-ext.so}\ {surbl}{$mime_decoded_filename}} warn condition = ${if eq{${lc:$mime_content_type}}\ {text/html}} set acl_m9 = ${dlfunc{/usr/local/exim/exim-ext.so}\ {surbl}{$mime_decoded_filename}} deny !condition = ${if eq {$acl_m9}{0}} message = SPAM not welcome ($acl_m9) log_message = DATA detected SPAM ($acl_m9)