Configure Sendmail to listen on multiple ports

I’m not a fan of sendmail, as anyone I’ve worked with can attest to. There are other MTAs out there that are every bit as capable while being much easier to work with. I like Postfix, personally, but Exim is pretty nice too.

Anyway, I was recently tasked with configuring sendmail to listen on port 587 as well as port 25 for the use of some of the system’s users who found their outbound port 25 access restricted on their new home cable modem (quite understandably, I might add).

A few minutes googling for help showed me that there’s a real lack of clear instruction out there on this. Some instructions say to edit sendmail.cf directly, which is a bad idea, while other say to comment out FEATURE(`no_default_msa',`dnl') before adding the additional port configuration. This last caused the MTA to stop listening entirely.

So here’s what I did to get sendmail to listen on the additional port 587 as well as the default port 25. This was done on a Redhat system but should work on any distribution running sendmail. In /etc/mail/sendmail.mc, you need the following two lines:

DAEMON_OPTIONS(`Port=smtp, Name=MTA')dnl
DAEMON_OPTIONS(`Port=submission, Name=MSA, M=Ea')dnl

The second line should already be there, but commented out. This enables listening on port 587. The first line is required if you want to also continue listening on port 25, which is necessary if this machine receives mail from the public at large.

Reload sendmail and you should be good to go.

Comments


Other 	dnl # The following causes sendmail to only listen on the IPv4 loopback address
Other 	dnl # 127.0.0.1 and not on any other network devices. Remove the loopback
Other 	dnl # address restriction to accept email from the internet or intranet.
Other 	dnl #
Other 	dnl DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl
Other 	dnl #
Other 	dnl # The following causes sendmail to additionally listen to port 587 for
Other 	dnl # mail from MUAs that authenticate. Roaming users who can't reach their
Other 	dnl # preferred sendmail daemon due to port 25 being blocked or redirected find
Other 	dnl # this useful.
Other 	dnl #
Other 	dnl DAEMON_OPTIONS(`Port=submission, Name=MSA, M=Ea')dnl
Other 	dnl #

This is sample output from the webmin interface the only thing that makes me nervous is that your example does not contain a reference to Addr=127.0.0.1 is this going to break things if I remove the ‘dnl’ references in front of these lines?


Leave the loopback address line commented; uncommenting it will restrict sendmail to listening on this address instead of all available interfaces. Not what you want if you need to send mail to/through this machine.

Your comments are welcome

I'll help where I can. If you're really stuck, I'm available for consulting on an hourly or project basis. Get in touch for details.

Comment notes

  • Fields marked with a * are required.
  • Your e-mail address will not be published or spammed.
  • Allowed HTML: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="">