Use procmail to sort incoming emails
This is work in progress!!
Procmail is a versatile program that lets you filter incoming emails and do all sorts of processing on them. Sorting them, forwarding them, using an application to process them etc. I mainly uses it to sort email into folders depending on their origin or destination.
Log into Bubba via ssh and become root.
apt-get update apt-get install procmail
Configure Postfix to deliver incomming email to procmail
Edit the file /etc/postfix/main.cf and add the line:
mailbox_command = /usr/bin/procmail -a $DOMAIN
For each user that receives email create the config file /home/"user"/.procmailrc with something like:
# Set to on for debug VERBOSE=off DEFAULT=$HOME/Mail/ MAILDIR=$HOME/Mail PMDIR=$HOME/.procmail LOGFILE=$PMDIR/procmail.log INCLUDERC=$PMDIR/rc.filters
Make sure that this file has proper permissions. Otherwise procmail wont touch it.
chmod 0600 ''/home/"user"/.procmailrc''
(Todo, should DEFAULT & MAILDIR perhaps be moved to postfix config?)
Then create the procmail directory associated with this
Finally set up any filter rules needed. As an example, put all incomming emails from email@example.com into the folder ernie edit the file /home/"user"/.procmail/rc.filters and add the following lines:
:0: * ^From firstname.lastname@example.org .ernie/
To finnish everything off and start using procmail restart postfix
Now all emails comming from ernie would end up in a subfolder to the inbox called ernie. All others should still end up in your inbox.
You can read more on procmail on its homepage www.procmail.org/
To be written