I'm not sure what to do about this. When on a different IP (the same server set up, domain etc), we had no problems with email deliverability. Since transferring to EC2, despite having the AWS imposed SMTP limits removed, I'm finding that my server's email goes into my spambox. My site sends several hundred (legitimate, opt-in) emails a day. What do you think is the best solution here?


  • That could be a reputation thing, may be the EC2 ip address blocks have a bad reputation. Try getting your ip addresses into one of those global whitelists for mass mailers.
    – topdog
    Aug 1 '10 at 6:52
  • 3
    Just to follow up, we ended up using Postmark (third party mail delivery service) to deliver our mail. We might swap to Amazon SES in future; it wasn't available when this question was asked.
    – chrism2671
    Jul 26 '11 at 7:56

Amazon has now released their own email service. Amazon SES. Thats your best bet for just sending mail. http://aws.amazon.com/ses/

If you want more detailed statistics and insight into your mail like tracking opens and clicks you could use a third party SMTP server, the old favourite is AuthSMTP, if you want something a little more modern and cheaper try Elastic Email (http://elasticemail.com).


EC2 now lets you do configurable reverse DNS, which is a big help if you're trying to send out email from an EC2 instance. Have a look at this AWS blog post for more details.

  • 1
    This is good, but only a half solution to a bigger problem that Amazon is facing. In the meantime, I'll be bypassing the problem by setting up an external mail server- but it's frustrating because AWS is costly enough without having to pay for their misgivings too!
    – chrism2671
    Aug 3 '10 at 13:45

Generally EC2 IPs are banned and blacklisted almost in all spam filtering service due to an unfortunate thing that spammers like to buy instances and use it for spamming.

The only thing that you could do about it is to use elastic IP and ask the common spam filtering services to remove your /32s.

Other solution would be to use some SMTP proxy service somewhere.


This is what worked for me after some trial and error with the EC2 instances

  1. Using /sbin/postfix instead of /sbin/sendmail
  2. I set my mailserver's hostname in /etc/postfix/main.cf like this: myhostname=www.your.tld (change www.your.tld to your server's name)

  3. I set a Sender Policy Framework (SPF) record up in my DNS like this: @ IN TXT "v=spf1 a +all"

  4. I set a DKIM record up in my DNS like this: _adsp._domainkey.your.tld IN TXT "dkim=unknown" (Change your.tld to your domain name eg. example.com)

  5. I requested reverse-DNS be setup on my Elastic IPs to resolve to my domain using the AWS contact form at https://aws-portal.amazon.com/gp/aws/html-forms-controller/contactus/ec2-email-limit-rdns-request

My web application's mails don't get routed to spam by GMail anymore. Not until they dream up some new anti-EC2 -err anti-spam cock and bull anyway!

  • what's dkim=unknown all about?
    – osullic
    Apr 26 '20 at 23:23

In my opinion its a bad idea to have a +all in SPF record. +all means pass all, as good as not having an SPF record. You should change it to something like

@ IN TXT "v=spf1 +a +mx ip4: ip4: -all"

+a means allow all ips which have an A record in the DNS
+mx means allow all ips with an MX record in the DNS
ip4:n.n.n.n means allow this IP to send emails
-all means do not allow anything else to send emails from this domain. The rules are checked from left to right. hence -all in the end will disallow anything that did not satisfy the earlier rules



should be changed to


Hmmm in my case using postfix and forward emails via authsmtp or sendgrid.

http://pauldowman.com/2008/02/17/smtp-mail-from-ec2-web-server-setup/ http://wiki.sendgrid.com/doku.php?id=postfix


Take this Email Server Test. It will give you possible suggestions to implement. If you are unable to implement the suggestions (or) still have issues, you can get an SMTP Relay Service


If you fill out this form and include your Elastic IP addresses, your IP addresses will not be listed on the blacklists (after a couple of days) unless you actually start spamming from them.


By default, EC2 IP addresses are greylisted on most spam lists due to their dynamic nature. Submitting the request above will make it so your IP addresses aren't grey listed.

  • The only actual answer to the question, IMO. Aug 14 '14 at 17:37

It's a bit dangerous to use EC2 to send emails. EC2, by its nature, allows you to rapidly spin up and take down machines, which makes it great for sending spam. I would recommend you send your emails out of a fixed SMTP host dedicated to your company. I've actually done this myself: Our new startup runs on EC2, but sends emails using Google Business Email services on IMAP.

Simon @ LabSlice

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.