Possible Duplicate:
Lightweight outgoing SMTP server

I am looking for a minimal mail solution (MTA) for a headless server which generate e-mails for local users and and fully qualified addresses from cron-jobs, etc. Ideally all mails to local user foo should be mapped to foo@mydomain, with possible modifications for uid<1024, and sent off to an external smtp server without involving /var/mail.

Some years ago, I used sSMTP for a similar task, and I was wondering if this is still the way ahead? Also, how much of the default debian mail system should/could I remove?

Update Ended up Googling a bit, and the obvious candidates seem to be

Even though eSMTP is not developed anymore, it seems to have the nicest documentation. It doesn't quite fit my needs though, at it seems to insist on delivering mail to local user foo via a Mail Delivery Agent (MDA) instead of pushing it out over smtp to foo@some.domain. Or maybe it does do the mapping if I add qualify_domain to the config. Might have to try it out...
nullmailer appears to be running a queue in /var, which is not something I want.

Does anybody have experience with any of these?

marked as duplicate by Michael Mrozek Jan 14 '11 at 22:38

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 2
    Oops -- possible dupe of this question: unix.stackexchange.com/questions/1449/… – Janus Jan 14 '11 at 15:16
  • I closed as a duplicate, but I don't think it can be cleanly merged; most of these answers reference the question in ways that won't make sense on the other post – Michael Mrozek Jan 14 '11 at 22:39

Nullmailer might fit the bill:

Nullmailer is a mail transport agent designed to only relay all its messages through a fixed set of "upstream" hosts.

If you just install the Debian package, it will replace whatever MTA was there before.


My recommendation would be nullmailer too. We were in a similar situation before (need to use a second MTA in Zimbra boxes for system-generated mail) and it fits the bill nicely.

However, your requisite of not using /var is a hurdle. Could you elaborate on the reasons why? If the problem is using the disk at all, you could mount nullmailer's queue on tmpfs. It wouldn't be quite safe, but at least it wouldn't touch the disk at all.

  • Thanks. Yes, I want to avoid var to keep the disk idle. You are right about tmpfs of course, but I'd like to keep it as simple as possible... – Janus Jan 14 '11 at 5:36

IMHO, the easiest way to do this is to install postfix (if debconf asks you questions, pick "internet site"), then run these commands:

postconf -e relayhost=other.mailserver.com
postconf -e mailname=my.domainname.com

As long as the SMTP server specified in relayhost doesn't require authentication, allows you to relay or is a valid destination for the recipient address this will work.

The mailname parameter will be the default domain name. So if you send mail to foo it will go to foo@my.domainname.com. Mail sent by user bar will be from bar@my.domainname.com.

If you do need to authenticate and want to support TLS, also run the following commands:

postconf -e smtp_tls_security_level=may
postconf -e smtp_sasl_auth_enable=yes
postconf -e smtp_sasl_password_maps=pcre:/etc/postfix/sasl_password_maps

Then in /etc/postfix/sasl_password_maps have this content:

/./ username:password

All mail will be sent to your relayhost with the specified username and password.

  • I'll need the authentication. Plain could work, but StartTLS would probably be nice. But installing postfix seems like it would be massive overkill?! – Janus Jan 14 '11 at 5:41
  • I updated my answer to include client auth and TLS support. – bahamat Jan 16 '11 at 19:25

Not the answer you're looking for? Browse other questions tagged or ask your own question.