Re: [Exim] quotas on non-appendfile transports

Page principale
Supprimer ce message
Répondre à ce message
Auteur: Christian G. Warden
Date:  
À: exim-users
Sujet: Re: [Exim] quotas on non-appendfile transports
On Fri, Jul 25, 2003 at 11:57:56AM +0100, Philip Hazel wrote:
> On Thu, 24 Jul 2003, Christian G. Warden wrote:
>
> > I'd like to enforce quotas within Exim for a pipe transport.
>
> What exactly do you mean? Do you mean "don't deliver messages over a
> certain size to this transport"? If so, you can do that by looking at
> the $message_size variable in the router that routes to the transport.
>
> First router: check other conditions, check size, if OK, route to transport
>
> Next router: check other conditions, (size must be bad), generate bounce
>              with :fail: or defer (check $message_age?), or route to an
>              autoreply transport to send a message


Thanks, but I think the check needs to be in the transport because the
routers check the conditions before expanding the data. I'm using
redirect routers with Exim filters. The filter may not cause any local
deliveries and I don't want to enforce quotas on mail that is getting
redirected to an external server.

I make deliveries to local users look like directories because usernames
look like email addresses. The transports pull out the username (and
mailbox in the deliver_to_mailbox transport) from $address_file.
So the "filter" router can cause redirects to user@??? or
/user@???~MAILBOX/
The "aliases" router can redirect to user@??? or
/user@???/

Routers

filter:
driver = redirect
allow_filter
allow_fail
data = ${lookup mysql{SELECT filter ...}{$value}fail}
directory_transport = deliver_to_mailbox

aliases:
driver = redirect
data = ${lookup mysql{SELECT ...}{$value}fail}
directory_transport = deliver_to_user
no_more

Transports

deliver_to_user:
driver = pipe
command = deliver -u ${substr_-1:${substr_1:$address_file}}
# enforce quota. expansion is forced to fail if quota is exceeded
# so that delivery is deferred rather than failed.
message_size_limit = ${lookup mysql{SELECT ...}{0}fail}

The deliver_to_mailbox transport is basically the same, but extracts the
username and mailbox name from $address_file.

Thanks for your help,
xn