Re: [Exim] Selectively Limiting $message_size using a router…

Page principale
Supprimer ce message
Répondre à ce message
Auteur: Nico Erfurth
Date:  
À: Odhiambo G. Washington
CC: exim-users
Sujet: Re: [Exim] Selectively Limiting $message_size using a router/filter (Global)
Odhiambo G. Washington wrote:
> Hello Eximers,
> (I guess this is a good name, no?)
>
> I've had a request from a user and I believe it's practical. I know I can run
> a router just before the local delivery to do it, since Exim is able to know
> the $message_size. What I don't know is how to write the router :)
>
> Two users have asked me to block any mail sent to them that is surpasses some
> $message_size. One of them wants all mail over 3MB to be rejected with some
> message. The other one prefers 5MB. On my server, the global message)size limit
> is 10M, which I believe is stupid for an ISP which has some clients with pretty
> good connections.
>
> I know the $message_size is available for the system filter also but I was
> wondering if people have recommendations. Looking at the filter specification,
> I've noted two possibilities:
>
> if $message_size is above XX
> ${ if >{$message_size}{4M} .....
>
> The problem is that both users (and some others yet to come) all prefer different
> values. I was thinking that I could use a flat file, or some db where I could store
> username:$message_size values, like
>
> user1:    3M
> user2:    5M

>
> I'd like to do this globally, not via some .forward as maintaining that would be
> a pain in the $%*.... MySQL would be a good option but my users are not MySQL based.
> These are system accounts.
>
>
> Any pointers/suggestions most welcome.


You should do it as router, not as filter, the filter will be run only
once per message (IIRC), a router will be run per address.

This should be placed after your alias-handling.

bounce_because_size:
   driver = redirect
   data = ${if > {$message_size}\
             {${lookup {$local_part} lsearch {/file}{$value}{10G}}\
           {:fail:}}
   allow_fail
   no_verify


(I don't know if it will work, but try it ;))

ciao