简体   繁体   中英

Sending emails to AWS SES from EC2 with no elastic ip

I have a small application running on Python Flask on EC2. Customers have been complaining not getting system emails. I have the production application load balanced on EC2. I just noticed that the reliability of emails seems to improve once each server has an Elastic IP. Since I have a load balancer I don't usually assign the IP to the production machines and only assign an Elastic IP to the test machines and only assign the ip address to production to keep it without additional charge when I don't require a test environment.

Do I need an Elastic IP per server that are each talking to the email server (SES) when required?

Note: SES is not available in my AWS region.

I'm going to take a guess that you are using sendmail to send the emails, correct?

According to the Amazon SES Docs :

(Optional) If you are sending email through Amazon SES from an Amazon EC2 instance, you may need to assign an Elastic IP Address to your Amazon EC2 instance for the receiving ISP to accept your email. For more information see Amazon EC2 Elastic IP Addresses. )

I'd suggest moving away from sendmail and use Boto to integrate with SES or submit your emails via SMTP to Amazon from your Python app.

Update

The comment from Michael - sqlbot made me think to investigate further, here is what I found.

I remember learning about reverse DNS lookups on email, and found the following:

Amazon now has a new email policy in which outbound SMTP traffic is blocked (beyond miniscule usage). In order to be able to send email directly from EC2 you also need to provision an Elastic IP address for your instance. Amazon will work to keep that Elastic IP of of the common anti-spam lists.

as well as

Amazon has announced a new private beta where they will set PTR records for your Elastic IP address.

Taken from Sending Email from EC2 . The article explains all the details in delivering email from an EC2 instance and its problems. Even though it's old, I believe the reverse lookups apply now more than ever to fight spam.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM