Re: [exim] Checking quotas at SMTP time: a solution for mail…

Top Page
Delete this message
Reply to this message
Author: Dean Brooks
Date:  
To: exim-users
Subject: Re: [exim] Checking quotas at SMTP time: a solution for maildir++
On Sun, Aug 22, 2004 at 07:00:49PM +0100, Tim Jackson wrote:

> * By default, when using Exim's inbuilt quota support, messages for users
> who are over-quota will be accepted at SMTP time, and a bounce message
> will be generated. This is less than ideal.


Ran into this exact problem some months ago.

We have a simple mail store in /var/mail, with both OS and Exim quotas
implemented.

For us, the simplest thing was the addition of a few macros at the top of
our config file, and a router added before local deliveries are handled.
There is also a "quotas" file that we maintain that hold the quota values
for any customer that does not have the default quota of 10 meg. That
text file contains multiple lines in the form of "username: 30M" or similar.

It's not pretty, but it is functional if you have a simple mail store.

Macros:

EXIMDIR=/usr/local/exim
QUOTA_DEFAULT=10M
GET_QUOTA=${lookup{$local_part} lsearch{EXIMDIR/quotas}{$value}{QUOTA_DEFAULT}}
MAILBOX_SIZE=${extract{size}{${stat:/var/mail/$local_part}}{$value}{fail}}

Router:

rejectquota:
  driver = redirect
  domains = +localdomains
  check_local_user
  require_files = /var/mail/$local_part
  condition = ${if >{${eval:MAILBOX_SIZE+$message_size+25K}}{GET_QUOTA}{1}{0}}
  allow_fail
  data = :fail: ${if <={$message_size}{GET_QUOTA}{Mailbox is full}\
                  {Message too large to fit in mailbox {$message_size bytes)}}
  no_verify_sender
  fail_verify_recipient


--
Dean Brooks
dean@???