SMTP can operate over ports 25, 587, or 2525 but the default port used in an EC2 instance is port 25. Amazon Web Services’ EC2 instances are throttled on port 25 by default as a spam prevention measure. This can cause connection issues when attempting to use SMTP to relay emails through Postmark in your EC2 instance. There are a couple ways to resolve this issue so that you do not receive connection errors when using Postmark in your EC2 instance.
Have AWS Remove Port 25 Throttling
You can request Amazon Web Services to remove the throttling on port 25 using the
Request to Remove Email Sending Limitations
form. Note: you must sign in with your root account credentials
. Amazon Web Services will request that you provide a use case description with your request to remove the throttle. Once your request is approved, they will alert you via email that the block has been removed.
Change SMTP Port(s) in Your EC2 Instance
In my EC2 instance I am using an Amazon Linux AMI with sendmail, that is configured to use Postmark via SMTP. If you need instructions on setting up sendmail with Postmark, please see
Ensure Ports 2525 and 587 are Open for Your EC2 Instance
Log into your AWS management console and click EC2.
Click Security Groups on the left.
Create a new Security Group, which you can name ‘Open Additional SMTP ports’, for example.
Add custom TCP rules for ports 2525 and 587.
Note: You can also manually add each of our SMTP endpoint IPs found here for added security by using the ‘custom ip’ option when adding the rules to the security group.
Navigate back to your instance(s). Assign this new security group to your EC2 instance by checking the box next to your instance then clicking
Actions > Networking > Change Security Groups.
Check the box next to the security group you just created and assign it to the instance.
Finally, ssh into your console and change the ports used for SMTP in sendmail to 587 and/or 2525.