Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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?

Chris.

share|improve this question
    
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
2  
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

9 Answers 9

up vote 6 down vote accepted

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).

share|improve this answer

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 what you could about it 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.

share|improve this answer
    
And you should set up rDNS. You can do this by filling in a form at the AWS configpage. Make sure the forward-DNS is the same. –  Bart De Vos Oct 3 '11 at 20:25
    
@BartDeVos: AWS configpage. Which one you mean by that? After login to there portal it has many tabs. For EC2 you mean should be available? –  YumYumYum Apr 16 '12 at 19:38
    
@YumYumYum: Here you go: aws-portal.amazon.com/gp/aws/html-forms-controller/contactus/… –  Bart De Vos Apr 17 '12 at 8:29

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

share|improve this answer

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.

share|improve this answer
    
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

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

share|improve this answer

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

share|improve this answer

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.

https://aws-portal.amazon.com/gp/aws/html-forms-controller/contactus/ec2-email-limit-rdns-request

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.

share|improve this answer
    
The only actual answer to the question, IMO. –  cloudsurfin Aug 14 at 17:37

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!

share|improve this answer

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:1.2.3.4 ip4:5.6.7.8 -all"

where
+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

Also

"dkim=unknown" 

should be changed to

"dkim=all"
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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