Nigel Metheringham edited this page Nov 29, 2012 · 2 revisions
Clone this wiki locally



Will Exim allow me to create a file of regexs and match incoming external email to the list - and if a match is found file the offending message into a special location? Also is it possible to make Exim only filter parts of an incoming email - e.g. ignore large MIME attachments for example and only process text/plain?


You can do some of this in a system filter. For example:

if $message_body matches <...some complicated regex...> or
   $message_body matches <...some other regex...> or
   $header_from: matches <...regex...> or
  save /some/special/file

or instead of save you could have deliver (to some address) or pipe (to some script). There isn't any mechanism for ignoring attachments, but $message_body only looks at the first n bytes of the body, where n defaults to 500 but can be changed. A more expensive alternative would be to run a Perl subroutine using the embedded Perl mechanism. If you passed over the message id, the Perl code could read the message files on the spool and implement any algorithm it liked for deciding what should be done.