Here’s a technical note for other Pair.com customers who are puzzling through getting e-mail filtering to play nice with procmail, in the hope that the hours I burned up getting this working will pay off others. I don’t claim that this note is without error, so you’re on your own if you follow my advice. I did retrace my steps as I wrote this, and I welcome corrections.
Note: This is a partial solution. As of 7/1/2006, email to domains you host at pair.com can be filtered and passed to procmail, but email to @pair.com email address can only be filtered. So don’t give that address out lest it get into the hands of spammers.
The preliminary steps are through the Control Center web interface.
- Log in, and click the “E-Mail Management” button.
- The “Use greylisting” option cuts down on drive-by spam at the expense of a slight delivery delay. I left if off at first, and turned it on later. It seems to help.
- Virus detection is kind of a no-brainer if you’re reading email from Windows.
- I tried various SpamAssassin settings, and settled for the Default.
- I chose to leave my subject lines unmodified, because I’m using procmail to further filter mail on the server side. If you’re going to do client-side filtering and your email client won’t filter on custom headers, you’ll need to check this.
- Click “Commit Changes”.
- At the top of the page, click “Return to E-Mail overview”.
In the “General E-Mail Settings” section, there are two links: one for your @pair.com address, the other labeled “General”. Click into both of these in turn, and
- Make sure “Store e-mail for … in the Main Account Mailbox” is selected.
- Check “Enable Junk E-Mail Filtering” radio button, but leave the “Save Junk E-Mail in this File” box blank.
- Click “Commit Changes”.
- At the top of the page, click “Return to E-Mail Overview”
You can stop at this point and tweak your email client to look for the “X-Spam-Flag: YES” or the “X-Spam-Level:” headers in email that you pick up via POP3. Or, if you’re already familiar with procmail, you can use procmail to do additional server-side filtering. procmail is a bit tricky and finicky, so I won’t try to describe it here (I.e., danger ahead, you’re on your own).
The trick at Pair for making procmail work is to read the Using QMail article in the support knowledge base. Assuming you’re hosting a domain, say example.com, at Pair, edit or create the file ~/.qmail-example:com-default to read
!preline /usr/local/bin/procmail
This causes incoming email to @example.com address to get passed to procmail for filtering. The colon in the filename is deliberate. If you’re hosting multiple domains, you’ll have a .qmail file for each.
My .procmailrc file has this rule for saving spam on the server side.
:0
* ^X-Spam-Flag.*YES
Mail/spam
The rule is preceeded by a whitelisting rule that allows a select set of friends to send me content that might risk a false positive.
If you dabble in procmail, I highly recommend putting the “safety net” recipe in the procmailex(5) man page at the top of your .procmailrc