I wasn't able to find much in the way of useful information while searching for dbmail and per-user procmail configurations. So, I rolled my own, based on some of the stuff I found, and I'd like to post it here for the archive. If any of you have comments, they are certainly welcome. :)

Naturally, this uses Postfix as the MTA. :P

### Begin example ###

# /etc/postfix/master.cf
# This creates a service called procmail which is used to deliver
# the mail.  See `man 8postfix pipe` for more information.  The
# -a argument passed to procmail sets ${recipient} as the $1
# variable in the procmailrc file.  ${recipient} is the fully-
# qualified email address of the recipient, e.g.
# [EMAIL PROTECTED]  Note there should not necessarily be
# a line break between ${recipient} and /etc/procmailrc.

procmail unix - n n - 4 pipe
flags=DRhu user=dbmail argv=/usr/bin/procmail -a ${recipient} /etc/procmailrc

# /etc/postfix/main.cf
# This tells Postfix to use the new procmail service to deliver mail.

mailbox_transport = procmail

# /etc/procmailrc
# Note the INCLUDERC line, which includes an RC file based on the
# recipient's fully-qualified email address.  If this file does not
# exist, procmail ignores it and continues, which I think is quite
# useful.  The LOGFILE line produces per-user logs, which should be
# rotated or otherwise managed in the usual way.

MAIL_DELIVERY="/usr/sbin/dbmail-smtp -d $1"
LOGFILE=/usr/local/var/log/procmail/$1.log
INCLUDERC=/usr/local/etc/procmailrc/$1

:0
| $MAIL_DELIVERY

# /usr/local/etc/procmailrc/[EMAIL PROTECTED]
# This is an example of what one might put in a per-user procmail
# script.  For testing purposes, this one just delivers anything
# with 'foobar' in the subject to a special mailbox called CMUbox.

:0
* ^Subject.*foobar
| $MAIL_DELIVERY -m 'CMUbox'

### End example ###

I've been toying around with the idea of having per-user pre- and post- procmail scripts, where a global spam filter would be applied to the incoming email between the pre- and post- stages. I'm not sure whether that's a good idea or not, based on my requirements.

Colin
_______________________________________________
DBmail mailing list
[email protected]
https://mailman.fastxs.nl/mailman/listinfo/dbmail

Reply via email to