Configure sendmail to use Mandrill as SMTP relay

  13 Oct 2014


Some of applications that installed on Linux usually expect sendmail to work but the problem is it does not always work ( at least with default configuration/installation via apt-get etc. ) I’m pissed off with this and people usually recommend to use another tools ( you name it ). You may be very lucky if it just works at the first time you installed. Sometimes, though, we just want to make the default installation work! ( in my case, recent failed is DokuWiki on Ubuntu ) without any application specific modification.

However, there is sort of hidden configuration for sendmail that people ignore. That is you can set an SMPTP relay host with sendmail called SMART_HOST. To do so, you could follow this steps:

  1. Define SMTP relay host and credentials.

Use your SMTP/API Username and Password in https://mandrillapp.com/settings, put in the following file in the format like this:

cat > /etc/mail/authinfo

    AuthInfo:smtp.mandrillapp.com "U:USERNAME" "P:PASSWORD" "M:PLAIN"

Also, at the bottom of /etc/mail/sendmail.mc file, add following lines:

    define(`SMART_HOST', `smtp.mandrillapp.com')
    FEATURE(`authinfo')
  1. Regenerate /etc/mail/sendmail.cf file by:

     cd /etc/mail
     make
    
  2. Then, restart sendmail:

    service sendmail restart
    
  3. Test sending email run: sendmail user@supermail.com

And, enter the following:

Subject: Hello test

Hi, ignore. this is my test message
.

Finally, check your recent activity at https://mandrillapp.com/activity

comments powered by Disqus