Configure nullmailer to use SMTP authentication


nullmailer is a minimalistic and easy to configure MTA (mail transport agent). It is described on the homepage as follows:

Nullmailer is a mail transport agent designed to only relay all its messages through a fixed set of “upstream” hosts. It is also designed to be secure.

nullmailer is a good choice for systems that do not receive, but send mails like for example web servers.

To setup nullmailer to relay the mails to a smtp server that needs smtp authentication, just add the login credentials to the configuration file (/etc/nullmailer/remotes on Ubuntu systems)

[YOUR-SMPT-SERVER.COM] smtp --auth-login --user=[USER] --pass=[PASSWORD]

and (for security reasons) set the permissions as follows:

# sudo chown mail /etc/nullmailer/remotes
# sudo chmod go-rwx /etc/nullmailer/remotes

Finally, restart the nullmailer service

# sudo /etc/init.d/nullmailer restart

To test the configuration, just use the mail command to send an e-mail:

# echo "This is a test e-mail..." | mail -s "Test e-mail" [YOUR-E-MAIL-ADDRESS]
,

3 responses to “Configure nullmailer to use SMTP authentication”

  1. That’s all good advice, but…

    If security is important, you should add this:

    chmod go-rwx /etc/nullmailer/remotes

    otherwise your smtp-auth password is readable by any process
    and any user on your machine.

    – Pat

    P.S. your spam protection should accept the answer spelled out 😉

  2. I am trying to configure nullmailer with Fastmail, the details I require configuring are:

    Mail Host – mail.messagingengine.com
    Server Port 465
    Use SSL
    Authentication Password

    any help on this would be appreciated as I am unable to make this work.

Leave a Reply

Your email address will not be published. Required fields are marked *