Finally! A simple SMTP email relay

I love using pine (now alpine) for email. I know the shortcuts, the editor, love the all-text mode. But I’m often writing mail offline and pine does not have a built-in mail spool. For a long time I’ve used postfix to receive and forward messages to a SMTP server. While simpler than the terrifyingly arcane sendmail, postfix is still complex, with many config files, and I’ve always had a hard time getting it to talk to the Harvard FAS MS-Exchange ESMTP server; as usual, this MS product is non-standard, idiosyncratic and buggy, requiring fiddling with 7bit/8bit mime and even requiring a recompile of postfix. I eventually gave up and used a Dreamhost SMTP server, but I know that this causes many messages to end up in recipients’ SPAM filters. Then, while at Logan airport, messages started getting bounced by the Dreamhost SMTP server because the IP I was at on the public wifi is on a Spamhaus blacklist. Ugghh. Why is it so hard to get an email message guaranteed to arrive? Arrival rates in inboxes are far higher for paper letters via the postal service than via electronic mail!

Anyway... back to the FAS SMTP server again. Before struggling with postfix again, I decided to see if there was a simple MTA I had missed, and lo and behold found emailrelay. Quick to set up:

  1. Install from source (no dependencies), or via AUR (in which case, fix /etc/rc.d/emailrelay to look for a config file at /etc/emailrelay.conf).
  2. Make a /etc/emailrelay.auth file with a line: login client <mylogin> <mypassword>
  3. Edit /etc/emailrelay.conf:
      spool-dir /var/spool/emailrelay
      client-auth /etc/emailrelay.auth
      client-tls
      forward
      forward-to smtp.fasmail.harvard.edu:587
      log-time
      poll 60
      port 8811
      verbose
    
  4. Add a directory /var/spool/emailrelay
  5. add emailrelay to /etc/rc.conf, or add using chkconfig and start the daemon
  6. (Leave postfix running, since there are many system services that use within-machine mail (anacron, etc), and emailrelay does not handle these.)
  7. Send your mail to localhost:8811 (NB: I wasted a lot of time with pine; it appeared not to be using the port I wanted, until I realized that the SMTP server was being set in a Role I created, not the main config section).

So far, works like a dream. Thank you Graeme Walker!