On Wed, Nov 13, 2002 at 09:12:58AM -0500, Michael Sprague wrote:
> I am setting up exim4 as the MTA and courier-imap as the IMAP/POP daemon and
> have a philosphical question.  I'm debating on whether to configure Exim4 to
> use deliverquota as the delivery agent or to build a local_delivery transport
> that mimics deliverquota using the directives built into Exim4.  As far as I
> can tell either will work but I'm curious about the opinions of fellow list
> members on which method seems to work best.

I have tried both, and recommend deliverquota.

The big advantage of deliverquota is its handling of deliveries to mailboxes
which already have lots of messages in them. Using exim's internal maildir
delivery it has to recursively list all files in all directories and add up
their sizes; I've seen this make NFS servers thrash. Switching to
deliverquota cures the problem, and the cost of an extra fork/exec is
minimal in comparison.

The transports I used are attached in case they're any use. Note that in the
routers I set address_data with the results of an LDAP lookup, so the quota
value can be extracted in the transport; I'm also doing all deliveries as
user 'exim'

Regards,

Brian.
# Delivery to Maildir++ file as user 'exim'

# Version 1: This one uses exim's built-in Maildir support. Note that it
# does not have full Maildir++ support, as it does not create the
# 'maildirsize' file, so it is not very efficient when delivering to
# mailboxes which contain thousands of files.
# See maildir/README.maildirquota.txt in the courier-imap distribution.

maildir_t_internal:
  driver = appendfile
  maildir_format

  user = exim
  group = exim

  delivery_date_add
  envelope_to_add
  return_path_add

  # Maildir++ format keeps the message size in the filename, so that
  # quota testing and POP3 maildrop listing doesn't need to stat every file
  maildir_tag = ,S=$message_size
  quota_size_regex = ,S=(\d+)

  # Quota handling. We pick up a quota expression in Courier's format,
  # which is "maxbytesS" or "maxbytesS,maxfilesC"
  quota = ${if match {${extract{LDAPATTR_QUOTA}{$address_data}}}{([0-9]+)S}{$1}{}}
  quota_warn_threshold = 90%
  quota_filecount = ${if match 
{${extract{LDAPATTR_QUOTA}{$address_data}}}{([0-9]+)C}{$1}{}}
  quota_warn_message = "\
                To: $local_part@$domain\n\
                Subject: Your mailbox\n\n\
                This message is automatically created \
                by mail delivery software.\n\n\
                The size of your mailbox has exceeded \
                a warning threshold that is\n\
                set by the system administrator.\n"


# Version 2: using the 'deliverquota' command provided as part of
# courier, which returns 0 in the case of successful delivery or
# 77 (EX_NOPERM) if it was over quota.

# Advs: updates 'maildirsize' file, and uses it as optimisation
# Disadvs: extra fork.

maildir_t:
  driver = pipe
  command = /usr/local/courier-imap/bin/deliverquota -c -w 90 $address_file 
${extract{LDAPATTR_QUOTA}{$address_data}}
  return_fail_output

  user = exim
  group = exim

  delivery_date_add
  envelope_to_add
  return_path_add
  message_prefix =
  message_suffix =

Reply via email to