[Mimedefang] Stream-by-domain-filter example filter

David F. Skoll dfs at roaringpenguin.com
Thu Apr 18 20:00:58 EDT 2002


On Fri, 19 Apr 2002, Anthony Giggins wrote:

> sub filter {
>     my($entity, $fname, $ext, $type) = @_;
>     if ($Domain eq "abc.com") {
>         # Filter actions for abc.com
>     } elsif ($Domain eq "xyz.com") {
>         # Filter actions for xyz.com
>     } else {
>         # Default filter actions
>     }
> }

> it has default filter actions at the bottom but these don't get run if
> domain is matched above. I assume the domain matches only cover incoming
> emails and the default filter covers outgoing emails?

With Sendmail 8.12, there is no difference between "incoming" and
"outgoing" e-mail.  The actions are matched *solely* on the domain
part of the recipient(s).  That's it.

> Would I be correct in saying the any filters you wish to be global are to be
> run before or after the Domain matches? And if so which would be more
> correct before or after?

It's a matter of taste, and it depends on exactly what your filter
rules do.  The Perl community has a horrible acronym called TIMTOWTDI,
which stands for "There Is More Than One Way To Do It". :-)

(The example above is just that -- an example.  If you want rules to
match no matter what, it's fairly simple to recode the filter to
handle that.)

Regards,

David.




More information about the MIMEDefang mailing list