开发者

Mail attachment killfile - how to blacklist signature attachments by filename

How can one best implement a minimal serverside mail filtering system which does one thing: remove signature attachments by name.

Some colleagues' every email contains an inline embedded "signature.gif" or "signature-nn.gif" (where nn appears to increment until their email client is restarted). Having a need to identify mails with (meaningful) attachments is hampered by the fact that开发者_JAVA百科 all their emails have (meaningless) attachments.

Ideally I'd like to be able to add new filenames to a blacklist, so that new embedded graphics could be easily zapped on mail receipt.

Mailserver is Exim on Debian Linux, so serverside mail filters such as procmail would be well suited. Clientside we have a variety of mail apps, so a clientside solution isn't as suitable.

How can this be done with Exim + Procmail (or equivalent?)


Without access to sample messsages, this is going to be a bit speculative, but something like this perhaps:

blacklist='signature|logo'  # maintaining in an external file left as an exercise

:0B
* $ ^Content-disposition: attachment; filename="$blacklist(-[0-9][0-9])?\.gif"
idiotbox

The main thing is you need the regex condition to uniquely match only those messages. Hopefully this should be enough to get you started. This attempts to look at a MIME header line in the body of the message -- if this is not present, or if it looks slightly different from what I have here (from memory), you need to adapt the regex.

IIRC the procmailex(5) man page has an example of how to keep stuff in an external file.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜