[Mimedefang] Per domain filtering

Kelson Vibber kelson at speed.net
Fri Nov 14 12:04:18 EST 2003


At 07:25 AM 11/14/2003,  Alain DESEINE wrote:
>I got on a mail server about 15 different domains. For 5 of theses domain 
>i need to do antivirus and antiSPAM filtering using spamassassin and 
>bitdefender. For the other 10 domains nothing should be done. So is there 
>a way to tell mimedefang to do nothing with some domains and to do "some 
>filtering"   (antivirux + antiSPAM) with other domains ?

filter_recipient would work for this, but it won't handle the case where 
you receive a message with mixed recipients (i.e. some in a domain that you 
want to filter, some in a domain you don't want to).

You'll need to call stream_by_domain early in filter_begin (check the 
mimedefang-filter man page for exact usage).  This will cause any "mixed 
messages" to be split into a separate copy for each domain, so (a) you'll 
know that all recipients are in the same domain, and (b) you can avoid side 
effects where settings for one domain influence messages that CC the other.

Also in filter_begin, before you do any scanning but after 
stream_by_domain, set a flag like $dont_filter.  Then wrap each call to a 
virus or spam scanner with "if (!$dont_filter) { ... }"

(Incidentally, you shouldn't write SPAM in all caps unless you're referring 
to the canned lunch meat produced by Hormel.  If you're referring to junk 
email, it should be in ordinary sentence case.)


Kelson Vibber
SpeedGate Communications <www.speed.net> 




More information about the MIMEDefang mailing list