After a few days of tinkering, I have finally configured things on the linode vps account so it works and does pretty everything I need.
I am using Debian 4.0. Had thought about using Ubuntu, but decided to stick with Debian as I have used it previously in the same capacity, without it failing me.
On a previous setup where I had smtp virtual accounts in the usual directory structure of;
/home/vmail/${domain}/${user}/Maildir
I was always looking for a way to have a .procmailrc for the smtp virtual accounts, and finally after a bit of research I have managed to put something together that works. I cannot give much technical details apart from the fact I can now have procmail rules for smtp virtual mail users, and also have those users even have a custom .procmailrc file that will be honoured.
I have a procmail entry in /etc/postfix/masters.cf like so below;
procmail unix - n n - - pipe flags=DRhu user=vmail argv=/usr/bin/procmail -t -m /etc/vmail-procmailrc ${recipient}
We then have the /etc/vmail-procmailrc file as below;
SHELL=/bin/sh VERBOSE=yes UMASK=007 ADRES=$1 ADRES=`echo $ADRES | /usr/bin/tr A-Z a-z` # force lowercase username DOMAIN=`echo "${ADRES}" | cut -d @ -f 2 | cut -d "<" -f 2| cut -d">" -f 1| cut -d @ -f 1` USER=`echo "${ADRES}" | cut -d @ -f 1 | cut -d "<" -f 2| cut -d">" -f1| cut -d @ -f 1` # get username for local delivery LOGFILE=/home/procmailnew.log # for testing & troubleshooting INCLUDERC=/home/vmail/${DOMAIN}/${USER}/.procmailrc # allow users to create their own recipes #LOGNAME: ${LOGNAME}" MAILDIR=/home/vmail/${DOMAIN}/${USER}/Maildir/
Then we have the following two lines in /etc/postfix/main.cf
procmail_destination_recipient_limit = 1 virtual_transport = procmail
And then you just drop an .procmailrc into each of the smtp virtual users home directory, one level above where the Maildir/ folder is. Since I don’t put mail into the directory based on the users name directly, I created a Maildir/ folder below it for mail.
/home/vmail/subdomain.heimic.net/username/.procmailrc
This was one problem that I never fixed when I was tinkering with this type of setup sometime back, finally I got a solution that works.
If anyone would like assistance, feel free to contact me. Always happy to help another fellow Debian/GNU Linux user.
Leave a Reply