22.04.2009 20:49

Personal e-mail solution

I wrote about my home LAN earlier and described my personal backup solution and now I'd like to talk about my mail system in the same environment. Thinking about this article I realized that they are in a way poor mans solutions, and I have plenty of those around to write about.

My LAN gateway is running a MTA and all workstations use it to send mail. My personal favorite MUA is Pine, now known as Alpine to which I'll come back later. So I run a very small mail system, with only a few users, yet with so much spam going around the system still processes thousands of e-mails every day. Which brings me to the SPAM filter. Probably best known and most used filter is SpamAssassin which is a huge monster that eats children, in my initial testing it would bring the system to its knees by processing only a handful of e-mails. There are many alternatives, like Dspam but let's not waste time on those. With some luck I managed to find a true gem, the CRM114 Discriminator which is an extremely small and lightweight filter. With some patient and smart training you can achieve good results and high accuracy.

I skipped a step didn't I, the MTA first forwards the message to the MDA, in my case that's procmail. It will analyze the message, forward it to the SPAM filter and then deliver to the respective mailbox. If you are interested in my own recipes one of my procmailrc files is available on-line.

Most people use IMAP these days, and maildirs, but I still stick to the mbox format. Besides, Alpine supports both mbx and mix variants so I have no urge to switch. Additionally mbox plays an important role in my setup. On most of my accounts I just setup forwarding to one central address. For a while that address was on a remote server which was also an extremely small mail system. When I needed to sync all those messages to my local mailbox I didn't really want to setup a POP daemon (although popa3d is really small and efficient, and would be a good fit) nor switch to IMAP. In the end I used rsync over SSH, a cronjob would need to sync only a few (mbox) files, transferring only the changes while using compression and with SSH providing encryption. So simple yet so effective, I was saving bandwidth while avoiding a pop3 daemon (with mandatory SSL, in case of popa3d stunnel would need to be used).

Enough about receiving e-mail, let's talk about sending. Alpine unlike some other MUAs doesn't require a local MTA or an SMTP client (by the way it also doesn't require a MRA like fetchmail). So there is not much to say about Alpine, you define your SMTP servers and you send your e-mail. But not having a local MTA can be a problem if you want to receive messages from cron, or so it might seem. All distributions ship with mailx and an easy solution is to setup your "~/.mailrc" like this:

set smtp=gateway.local.domain
set from=user@hostname.local.domain
You can then pipe your cronjobs to mail/mailx and send them where ever you want. My personal favorite mailx variant is mailx heirloom and some distributions like Slackware use it by default, others like Arch unfortunately use different implementations (by default).

An addition to this article will be about integrating Alpine with the desktop environment. It doesn't really belong here, but it also deserves some attention.


Written by anrxc | Permalink | Filed under main