2 Answers
- Newest
- Most votes
- Most comments
4
By default, AWS blocks outbound traffic on port 25 (SMTP) for most EC2 instances and Lambda functions to prevent spam and abuse, you may consider:
- Use an Alternative Port Many email providers (like Amazon SES, SendGrid, or Mailgun) support ports like 587 or 465 for SMTP with TLS/SSL. Switching to one of these is often the easiest fix.
- Request Port 25 Unblocking If you have a legitimate use case (e.g., running your own mail server), you can submit a request to AWS to remove the restriction.
- Use Amazon SES or a Third-Party Relay Amazon Simple Email Service (SES) is designed for sending email from AWS resources and doesn’t require port 25. You can also configure your app to relay through a third-party SMTP provider on an open port.
2
By default, AWS blocks outbound traffic on port 25 (SMTP) for all EC2 instances and Lambda functions to prevent potential spam. This is a standard restriction across AWS environments.
To resolve this issue, you have several options:
- Request removal of the port 25 restriction:
- Submit a request to AWS Support using the "Request to remove email sending limitations" form
- Provide details about why you need port 25 opened and how you'll prevent spam/abuse
- Include your instance ID in the request
- The approval process can take up to 48 hours
- Use alternative ports that aren't restricted:
- Port 587 (TLS)
- Port 465 (SSL)
- These ports are generally more secure and don't require special permission
- Use Amazon Simple Email Service (SES):
- AWS SES is designed specifically for sending emails from AWS resources
- It's a managed service that handles deliverability and reputation management
- Check your security configuration:
- Ensure your security groups allow outbound traffic on your chosen SMTP port
- Verify network ACLs permit the traffic
- Check that your instance's operating system firewall isn't blocking the port
If you choose to use alternative ports or SES, you'll need to update your application's SMTP configuration accordingly.
Sources
Troubleshoot an email server on an EC2 Windows instance | AWS re:Post
SMTP Limitation | AWS re:Post
Not able to send mail from EC2 | AWS re:Post
Amazon SES SMTP issues - Amazon Simple Email Service
Relevant content
- asked 6 months ago
- asked 6 years ago
- asked 6 months ago
- AWS OFFICIALUpdated a year ago
