Procmail Setup

Let's get started. I'll use the user called 'generic.' Make sure to put your own info in when required. Copy and paste the commands.


generic@froody:~> cd
generic@froody:~> mkdir .procmail
        creates the main procmail directory in your home directory.

generic@froody:~> cp /usr/local/share/doc/procmail/contrib/rupture.procmailrc .procmailrc
	imports the generic Rupture .procmailrc.  don't do this step
	if you already use procmail. 

generic@froody:~> touch .procmail/rc.kill
generic@froody:~> touch .procmail/rc.lists
        creates empty procmail recipe (rc) files if you don't have them already

generic@froody:~> cp /usr/local/share/doc/tmda/contrib/rupture.procmail.tmda.rc .procmail/rc.tmda
	imports the rupture rc.tmda 

generic@froody:~> cat .procmailrc
PATH=/bin:/usr/local/bin:/usr/bin/:/bin
SHELL=/bin/sh
MAILDIR=$HOME/mail     
#Directory for storing procmail log and rc files
PMDIR=$HOME/.procmail
LOGFILE=$PMDIR/log
INCLUDERC=$PMDIR/rc.kill
INCLUDERC=$PMDIR/rc.lists
#INCLUDERC=$PMDIR/rc.tmda
VERBOSE=yes
sendmail=/usr/sbin/sendmail
DEFAULT=$HOME/mbox
generic@froody:~> 

This sets the stage for procmail. The INCLUDERC statements tell procmail to read 3 recipe files (.rc). Recipe files contain recipes (procmail jargon for 'rules'). We created the files earlier by touching them. Now let's edit them:


generic@froody:~> cd .procmail
generic@froody:~/.procmail> pico rc.lists

:0:
* ^TO_tupperwareparties@yahoogroups.com
tupper

:0:
* ^TO_thursday@hellyeah.com
thursday

generic@froody:~/.procmail> 

These are recipes. It says that any incoming mail that is either To: tupperwareparties@yahoogroups.com or CC: tupperwareparties@yahoogroups.com should be put into the folder called tupper. The tupper folder is located at ~/mail/tupper. Remember the MAILDIR=$HOME/mail statement in .procmailrc? That's the base directory for procmail to use. The TO_ statement is a special procmail thing that lets you match both the To: and CC: fields in the email header. The other recipes say that email To: or CC: thursday@hellyeah.com should go into ~mail/thursday. These recipes should get you started. If you're really into this, look at ~jon/.procmail/rc.lists. There are a lot of good things in there.

Before you use TMDA, you really should make sure that all mailing lists you subscribe to are caught in your rc.lists. Because a large public mailing list can have thousands of subscribers sending email from thousands of addresses, it does not make sense to whitelist everyone. But if you process mailing list emails beforehand, TMDA will only work on emails that slip through (like spam). It is imperative that before you use TMDA, you set up procmail and make sure that all mailing lists and robots that send you email (CNN headline updates, Paytrust Bill Notifications, Dildo.com sales alerts) are covered by rules. Set up rules for all of them and make sure they are filtered into the right mailboxes. Then wait a few days. Then set up TMDA if all goes well.

What if you want to catch emails but just put them into your mailbox (instead of their own folder)? Do this:


:0:
* ^TO_partylist@party.com
$HOME/mbox

That will put them into your default mailbox.

When you're confident that procmail works the way you want it to, edit .procmailrc and uncomment the rc.tmda line:


#INCLUDERC=$PMDIR/rc.tmda

-->

INCLUDERC=$PMDIR/rc.tmda

You're filtering mail with TMDA now.

Should something go wrong, remove the .procmailrc file, or mv it to something else like .procmailrc-busted-as-shit.

How do you know if something goes wrong? Look at the logs.


generic@froody:~> tail ~/.procmail/log

How do you know that you caught all your automated emails with rc.lists? Run the tmda-pending command and look for emails that shouldn't have been caught. If you see genuine good emails that happen to come from robots that you like, either set up a rc.lists recipe to catch it before it hits TMDA or allow it in ~/.tmda/lists/whitelist.

Also, at this point, also see the TMDA (Incoming) Setup Instructions. And never be afraid to email the admin with specific questions.

<admin*rupture.net>

File /procmail/setup.shtml
was last updated : 05:25 PM 11/03/04