I became interested in running mail servers effectively just prior to the introduction of gmail, and unlike 90% of the technical community, I stubbornly perservered afterwards. Here are some (largely out-of-date) notes about running your own mail server; effective spam filtering and related topics.

sent mail

Keeping a record of sent mail is essential but saving it all in the sent folder is messy. At risk of flooding my mail folders, I save copies of my sent mail in the currently active folder. Therefore if I'm in my inbox, and I'm replying to a mail in my inbox, my reply will appear in the inbox (threaded appropriately).

managing email address proliferation

Opt-in spam: worse than the unsolicited type. Keep an "unsubscribe" folder so you know who you have attempted an unsubscribe from. Use a different address per sign-up service via e.g. plus addressing.

filtering

invoking spam filters via procmail

It's worth looking for subprocess return codes signifying failure, and doing something useful in that situation. This is especially true if your mail server is heavily loaded, and perhaps your spam filter will have malloc calls fail, or the OOM killer might catch it.

# filter any remaining mail
:0fw: $HOME/.crm114/crm114.procmail.lock
| $HOME/.crm114/mailreaver.crm -u $HOME/.crm114/

# catch the filter failing
:0 e
$HOME/Maildir/to-filter/

I have a script invoked via cron which checks the contents of $HOME/Maildir/to-filter and tries to run it through the spam filter again at a later date.

sender address verification

potentially expensive, not reliable for discrimination, avoid.

Miscellaneous software

  • exim - in my opinion, the best F/OSS MTA. Here's a fairly detailed MTA comparison where exim comes out on top if you need convincing.
  • procmail - a local mail-filtering tool. Horrid syntax, but very powerful.
  • crm114 - a fantastic, purely statistical spam filter.
  • crm114-spamd - a spamd-compatible server which back-ends to crm114, in order to achieve SMTP-time mail filtering (and rejection).
  • mutt - a UNIX, console-based mail client.
  • thunderbird - a cross-platform, graphical mail client. I didn't rate Thunderbird for a long time, but since 3.0 with local search, it's pretty damn good.
  • offlineimap - a script to synchronize a local mail folder (or folders) with a remote IMAP server. Excellent for backup or offline operation such as reading mail on trains, or for large-scale mail manipulation at speed.
  • mailarchive - move old mail out of one mailbox and into another (perhaps compressed, perhaps another storage (format, etc.)

External links

Interesting article: gmail vs pine