Skip to navigation

Maintaining a whitelist of e-mail senders with local mutt and procmail on a server

I run mutt locally on several different computers. OfflineIMAP automatically synchronizes the mailboxes, and that is a huge benefit. But I still had to set up a system that synchronizes my address books and mail settings. I’ve forgotten what exactly I am doing to accomplish this, and I now think there’s a small mistake somewhere that sometimes causes me to lose e-mail addresses from my address book. So I’ll write a little series in the category mail setup to document this on this blog, step by step, as I have time. This is the first instalment.

I maintain a whitelist of e-mail addresses to save spamassassin some work and myself some false positives.
To do this, I have a script that I run periodically (using crontab). The relevant lines of this script are (there’s some more stuff, since I also use it to blacklist things):

grep @ $ALIASFILE | cut -d "<" -f 2  | cut -d ">" -f 1 | grep -v " " > $WHITELIST
ping -c1 > /dev/null 2>&1
if [ $? != 0 ] ; then
  exit 0
  rsync $WHITELIST isomerica:.procmail/my_whitelist

The script just gets the e-mail addresses from my mutt alias file, combines this with any addresses from a manually maintained alias file, then uploads that to the server. On the server, the spam handling recipe in ~/.procmailrc does not pipe mail from these addresses to spamassassin, but everything else:

* ! ? (echo "$FROM" | $FGREP -f $WHITELIST)
| spamc
* ^X-spam-flag: yes

Comments are closed.