Configuring Sendmail for use with Alternate-Port SMTP

Configuring Sendmail is not easy. In fact, it’s a pain. So I took some time and waded through the m4 files and the hash maps and came up with some simple steps to getting your Sendmail configuration ready to use with Alternate-Port SMTP.

First, locate your configuration files. Usually they are in /etc/mail and that is the path we will use in this guide.

Create an authinfo file. In your favorite editor open /etc/mail/authinfo and add a line like this, replacing domain.com with your domain and YoUrPaSSw0rd, obviously, with your password. All one line, remember:

AuthInfo:smtp-auth.no-ip.com "U:domain.com@noip-smtp" "I:domain.com@noip-smtp" "P:YoUrPaSSw0rd"

Save the file and protect it with

chmod 600 /etc/mail/authinfo

Then map the file as usual with (though typing make in most systems (e.g. Red Hat EL) does this for you):

makemap hash /etc/mail/authinfo < /etc/mail/authinfo

Next, edit your sendmail.mc file. Add the following lines in a logical place. Usually some of these will be in there, commented out. Just add these near the commented out ones.

define(`SMART_HOST',`[smtp-auth.no-ip.com.]')dnl

define(`RELAY_MAILER_ARGS’, `IPC $h 3325′)dnl

FEATURE(`authinfo’, `hash /etc/mail/authinfo.db’)dnl

define(`confAUTH_OPTIONS’, `A,p,y’)dnl

Now rebuild your config by typing make on most systems or running your usual m4 command. Then restart Sendmail

Now try sending a test message via the sendmail command. If you see the words Sent (Ok: queued as … in your logs you know it worked! If you see stat=Service unavailable you probably have a mistake somewhere. Increase the verbosity of the logging (define(`confLOG_LEVEL’, `20′)dnl) and look for errors.

This configuration was tested with Red Hat EL3 and EL4 running Sendmail 8.12 and 8.13, respectively. Sendmail 8.14 should work as well. There are some differences if you are using Sendmail 8.11, like the format of the authinfo file. Please see your documentation for the changes.