- Newest
- Most votes
- Most comments
This issue is likely related to AWS's default restriction on outbound SMTP traffic. Here's what's happening and how to resolve it:
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, even if your security groups and NACLs allow the traffic.
While you mentioned that telnet to Gmail on port 25 works, this could be inconsistent behavior or potentially related to specific IP ranges. The core issue remains that AWS generally restricts port 25 traffic.
Here are your options to resolve this:
- 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 your legitimate use case
- Include your instance ID in the request
- Note that approval can take up to 48 hours
- Use alternative ports that aren't restricted:
- Try port 587 (TLS) or port 465 (SSL) if your Exchange Online configuration supports them
- These ports are generally more secure and don't require special permission
- Use Amazon Simple Email Service (SES):
- Consider switching to AWS SES, which is designed specifically for sending emails from AWS resources
- It's a managed service that handles deliverability and reputation management
Since you mentioned that port 587 is also failing, you should verify that your Exchange Online configuration properly supports this port, as it should not be restricted by AWS by default. Double-check your Exchange Online settings to ensure they're correctly configured for the alternative ports.
Sources
SMTP issue, not able to send out Email through the port | AWS re:Post
Not able to send mail from EC2 | AWS re:Post
Amazon SES SMTP issues - Amazon Simple Email Service
Amazon SES SMTP issues - Amazon Simple Email Service
answered a year ago
For everything you described, the issue is most likely related to IP reputation management by Microsoft Exchange Online. Here's how you could resolve this:
Immediate Verification Steps:
- Check if your IP is blacklisted using Microsoft's Remote Connectivity Analyzer
- Review your EIP's reputation at: https://sender.office.com
- Check major RBL (Realtime Blackhole Lists) for your EIP
Temporary workaround:
Allocate a new EIP and switch to it Configure proper PTR records for the new EIP Implement proper email authentication (SPF, DKIM, DMARC)
Hope it helps.
BR Alberto
Relevant content
- AWS OFFICIALUpdated a month ago
