FreeBSD + Postfix + Maildrop ============================ Changelog: Wed May 28 12:26:17 IST 2003 * Quota warnings using "maildrop -w N" Wed May 21 17:22:47 IST 2003 * Initial commit ### ### Overview ### Maildrop is a replacement local mail delivery agent, similar to procmail but with more features. It has support for LDAP lookups, mail filtering, mailbox quota and support for virtual mail acounts making it convenient to use in a black box kind of setup without any real accounts. The main benefit of using "maildrop" is for the quota feature withut mucking around file system quota. Quotas can be imposed on both the mailbox size and on the number of individual mails. NOTE: This quota mechanism will only work as long as maildrop (or deliv- erquota) are the only applications that deliver messages to the maildir, or as long as other applications implement the same quota enforcement mechanism. See maildirquota(7) This setup described here is for a standard mail server with user home directories and real accounts. The Setup: 1. Install Postfix and configure it to use "maildrop" as LMTP 2. Install Maildrop with ~/Maildir support 3. Create ~/Maildir with quota enabled using "maildirmake -q" ### ### Package Install ### - Install the following packages root# portinstall mail/postfix root# portinstall mail/maildrop WITH_MAILDIRQUOTA=yes - Maildrop + Maildir While compiling maildrop, make sure that the delivery format is set to "./Maildir". The default is to deliver to /var/mail/$USER. This is not runtime cofigurable and has to be done by adding the following line to maildrop/config.h before the port compile in the port directory. #define DEFAULT_DEF "./Maildir" (See http://www.flounder.net/~mrsam/maildrop/INSTALL.html for details) - Configure Postfix to use "maildrop" instead of procmail is the default LMTP. # use maildrop as LMTP mailbox_command = /usr/local/bin/maildrop local_destination_concurrency_limit = 1 [godzilla] ~> postconf |grep maildrop mailbox_command = /usr/local/bin/maildrop ### ### Creating ~/Maildirs ### - To create a Maildir for $USER with quota (10MB and/or 1000 mails) root# cd /home/$USER root# maildirmake -q 10000000S,1000C ./Maildir See maildirmake(1) and maildirquota(7) ### ### Testing Delivery ### root# echo | mail -s "Testing maildrop delivery" $USER /var/log/maillog: [...] May 21 17:39:40 godzilla postfix/pickup[75916]: 14D05B57E: uid=0 from= May 21 17:39:40 godzilla postfix/cleanup[75922]: 14D05B57E: message-id=<20030521120940.14D05B57E@godzilla.mydomain.com> May 21 17:39:40 godzilla postfix/qmgr[75917]: 14D05B57E: from=, size=340, nrcpt=1 (queue active) May 21 12:09:40 godzilla postfix/smtpd[75925]: connect from localhost.mydomain.com[127.0.0.1] May 21 12:09:40 godzilla postfix/smtpd[75925]: 39E36B57D: client=localhost.mydomain.com[127.0.0.1] May 21 17:39:40 godzilla postfix/cleanup[75922]: 39E36B57D: message-id=<20030521120940.14D05B57E@godzilla.mydomain.com> May 21 17:39:40 godzilla postfix/qmgr[75917]: 39E36B57D: from=, size=820, nrcpt=1 (queue active) May 21 12:09:40 godzilla postfix/smtpd[75925]: disconnect from localhost.mydomain.com[127.0.0.1] May 21 12:09:40 godzilla postfix/lmtp[75924]: 14D05B57E: to=, orig_to=, relay=127.0.0.1[127.0.0.1], delay=0, status=sent (250 2.6.0 Ok, id=41157-03-2, from MTA: 250 Ok: queued as 39E36B57D) May 21 17:39:40 godzilla postfix/local[75926]: 39E36B57D: to=, relay=local, delay=0, status=sent ("|/usr/local/bin/maildrop") ### ### Over quota delivery ### [...] May 21 08:19:35 godzilla postfix/lmtp[41373]: 7981EB578: to=, orig_to=, relay=127.0.0.1[127.0.0.1], delay=1, status=sent (250 2.6.0 Ok, id=41226-01, from MTA: 250 Ok: queued as 6AB55B577) May 21 13:49:35 godzilla postfix/local[41345]: 6AB55B577: to=, relay=local, delay=0, status=bounced (permission denied. Command outp ut: maildrop: maildir over quota. ) ### ### Quota Warning Message ### - Turn on warning messages in maildrop mailbox_command = /usr/local/bin/maildrop -w 50 - Create the /usr/local/etc/quotawarnmsg file [godzilla] ~# cat /usr/local/etc/quotawarnmsg From: Mail Delivery System Reply-To: postmaster@godzilla.mydomain.com To: Valued Customer:; Subject: Mail quota warning Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 7bit Your mailbox on the server is now more than 90% full. So that you can continue to receive mail you need to remove some messages from your mailbox. Not getting any warning messages? Check whether any quota has actually been imposed on the Maildir (~/Maildir/maildirsize) and also check for the presence of ~/Maildir/quotawarn file. Warnings are sent once in 24 hours. ### ### ToDo ### - Hook it upto LDAP so that I can have LDAP based quota settings - Figure out whether I can have vacation/auto responders using maildrop. Qmail sure makes this feature extremely convenient and easy to use. ### ### URLs ### RH7.1 > Postfix > Maildrop > Courier IMAP - How-I-did-it: http://www.firstpr.com.au/web-mail/RH71-Postfix-Courier-Maildrop-IMAP/