Amazon SES Blog

Amazon SES SMTP Recommendations

by Rohan Deshpande | on | in How To | | Comments

Amazon SES provides a native SMTP interface, so that you can use a wide variety of SMTP-enabled programming languages and software packages to send email through Amazon SES. More information is available in the Amazon SES Developer Guide. In this post, we would like to provide you with three recommendations that will improve your SMTP sending.

  1. If you are sending to Amazon SES from an EC2 instance via port 25, please submit a request to remove email sending limitations. EC2 imposes default sending limits on email sent via port 25 and throttles outbound connections if you exceed those limits. You can also connect to Amazon SES via port 465 and port 587, neither of which is throttled.
  2. SMTP is a verbose protocol and submitting an email using this protocol requires several network round-trips. Because of the nature of this protocol, the potential of transient network errors increases. Ensure that your application uses retry logic when connecting to the SMTP end point, and that it can detect and retry message delivery in case of a network error. A message is accepted by Amazon SES for delivery only when it responds with an Amazon SES Message ID.
  3. Do not maintain long-lived connections with the Amazon SES SMTP end point. The Amazon SES SMTP end point runs on a fleet of EC2 instances behind an Elastic Load Balancer (ELB). In order to ensure the system is up-to-date and fault tolerant, active instances are periodically terminated and replaced with new instances. Since your application connects to an EC2 instance through the ELB, the connection becomes invalid when the instance is terminated. Ideally, you should establish a new SMTP connection after you have delivered a fixed number of messages via a single SMTP connection, or if the SMTP connection has been active for some amount of time. You will need to experiment to find appropriate thresholds depending on where your application is hosted and how it submits email to Amazon SES.

If you have more questions about the Amazon SES SMTP end point, please continue to post them in the Amazon SES forum.