We have web application hosted on EC2. We use two Ubuntu servers: one is web server, second is database server. Web server has public Elastic IP assigned. Now we want to send notification mails from the application (notifications about changes in the system made by other users). The simplest solution would be to install postfix SMTP server on the web server, and register its Elastic IP in Amazon e-mail server registration form (so they register reverse-DNS, remove mail transfer restrictions etc). I hope this should work without much problem (correct me if I'm wrong).

If the load on the web server increases, we plan to start additional EC2 instances with replicas of web server, setup Amazon's load balancer in front of them, and remap the Elastic IP to this load balancer - so that from outside it still looks like single server. But what with SMTP server then?

I think the best solution would be to run local postfix server on each of those web servers - so that application running on every web server always contacts with local postfix server via localhost. Still, from outside it will look like one mail server running, because of one public IP. But i'm not expert in SMTP stuff, how the process of sending mails work etc.

Perhaps I'm not aware of something, which would cause such setup to break. What do you think, is this approach ok?


It's my impression that many (all?) of the AWS IP's have been blacklisted as spam sources already, so the deliverability of mail sent from them won't be very good.

Also, using an AWS host as a mailserver seems like a bad choice to me, because it may disappear at any moment - together with the undelivered E-mail.

It would make more sense to have each AWS host hand the mail off to either a service that's paid to handle your outbound mail, or a VPS or traditional server that you control that will be available approximately 24x7. This will make it much easier to get the SPF record set up, etc., to maximize the chances that someone will see your mail.

You might take a look at Recommendations for SMTP services for massive mailing or Sendmail relay out of Amazon EC2? for more ideas.

  • 2
    Well, I know that in the past there were problems with sending mails from EC2. However, a few months ago amazon started to offer reverse DNS service, they also claim that if I fill in special form with IP of my server and reverse DNS name for it, they will put effort to make sure this address is not blacklisted: aws.typepad.com/aws/2010/03/… That's why I though this problem is already solved. But maybe it's just marketing, and this doesn't work in reality? I'd be glad to hear opinions about what's the current status of sending mails from EC2. – Greg Jul 10 '10 at 12:19

I think that I already know the answer. This will not work, because the smtp servers will send mails directly, not tunneling through elastic load balancer. So, their IP will be different than the public IP assigned to load balancer, and reverse DNS will not match, so the mails will be potentially marked as spam. So it looks like I need one server with constant IP for running SMTP server.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.