Ubuntu Server How to Configure for Sendmail Port 587

Avoid AWS Blocking your Server from sending emails!
I was using AWS Amazon’s Web Service and one of my servers was set to reply to users contacting with a generic response. I had configured Sendmail and tested everything was working fine.

A day later, I got a message from AWS:

You recently reached a limit on the volume of email you were able to send out of SMTP port 25 on your instance…In order to maintain the quality of EC2 addresses for sending email, we enforce default limits on the amount of email that can be sent from EC2 accounts. If you wish to send larger amounts of email from EC2, you can apply to have these limits removed from your account by filling out our online request form.

What’s happening here is that SMTP is automatically set to use port 25 for sending out emails.  Port 25 is an open port and ISPs, along with AWS limits the traffic on that port to avoid spammers compromising or commandeering their servers for their own pursuits.

Move SMTP to port 587

Move your SMTP outbound traffic to port 587.  Port 587 is an MSA (message submission agent) port that requires SMTP authentication.  Keep in mind that port 587 is not intended for spam either.  It is, however, a better port to use to send authorized  emails from your server to your legitimate users.

Here’s the Fix!

Here’s how you can easily start sending email traffic over port 587 and possibly get off your ISP’s blacklist.

I’ll give instructions for Ubuntu server, however, the change should be similar on most Linux systems.

1.  In a Terminal open /etc/mail/sendmail.cf

sudo vi /etc/mail/sendmail.cf

2. look for these lines in the file:

# SMTP daemon options
O DaemonPortOptions=Name=MTA

and then add this line after them:

O DaemonPortOptions=Port=587, Name=MSA, M=E, Addr=127.0.0.1

Sendmail Using Port 587

3.  Restart Sendmail

sudo service sendmail restart

or… sudo service sendmail start

That’s it!  Now test sending an email to yourself from the server.  You can also check the sendmail log and outbox to make sure things are moving smoothly.

 

2 thoughts on “Ubuntu Server How to Configure for Sendmail Port 587”

  1. This post is solving the problem of sending mail from a different port than the std SMTP port that is configured at installation. It sounds like you have a different problem.

Leave a Reply

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