Re: [Exim] Filtering for incoming domain-name

Top Page
Delete this message
Reply to this message
Author: Philip Hazel
Date:  
To: EXIM Official Maillist
Subject: Re: [Exim] Filtering for incoming domain-name
On Tue, 12 Aug 2003, Jens Strohschnitter wrote:

> I want to expand my system_filter, that should freeze all mails
> > 500K with an exclude of mails that will be sent to a specific
> domain.
>
> For example, if a mail was sent with an attachment >500K and is
> sent to an user in the domain MyDom.com, the mail should not be
> frozen. Mails to any other users in other domains should still
> be frozen.


What do you want to do with an email that is addressed to BOTH?

> So I thought I can handle that with
>
> if $local_part@$domain is not "subdom1.mydom.com"
> then
>     logwrite "ok - no freeze !!"
> elif $received_protocol is not "scanned-ok" and $message_size above 500K
> then
>     mail text "Hm, your message is to big!"
>     freeze "Freeze, man freeze"
> endif

>
> But the variable $local_part@$domain is empty.


That is because a system filter runs only once. There may be many
recipients. So it can't set those variables.

If you want to do things for some recipients and not others, you can't
do them in a system filter. You have to do them in a router.
Unfortunately, however, though you can freeze from a router, you can't
freeze for some recipients and not others. Freeze stops all delivery.
You could defer, however.


--
Philip Hazel            University of Cambridge Computing Service,
ph10@???      Cambridge, England. Phone: +44 1223 334714.
Get the Exim 4 book:    http://www.uit.co.uk/exim-book