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.

Right now I am sending emails using the php mail() function. I am setting the From: header to an address corresponding to the hostname and also reverse-dns of the server sending the email like this:

$header = 'From: Foo <www-data@my-hostname-and-reverse-dns.com>' . "\r\n" .
    'Reply-To: bar@mydomain-but-not-my-hostname.com' ;
$x = mail($to,$subject,$body,$header);

This works fine so var, every email gets through with all providers I tested.

The hostname is just something long and generic from my isp that supplies the root server.

I know that I can have the From: -header corresponding to my domain if I change the hostname (either system or in sendmail) and set up reverse dns accordintly.

However hostname to the same domain as a website runs on can cause problems in apache (like delivering the default vhost and not the domain specific).

I know that this all can be handled, however I would like not to have to manage mailserver and so on and thoughta bout using Amazon Simple Email Service

I set it up and everything, but emails keep getting marked as spam by Gmail.

I was surprised, because the reverse dns and spf policies correspond to the envelope adresses. However gmail seems to particuarly strict when evaulating the From: -header.

So I added SPF and SenderID records to my DNS

(I read up on that and added them using a wizard tool, from my understanding they should be correct. maby i have an error in here?)

This is an example of an email sent by amazon

And this is the output of dig -t txt mydomain.com

;; ANSWER SECTION:
mydomain.com.       1800    IN  TXT "spf2.0/pra include:amazonses.com include:_spf.google.com  ip4:1.2.3.4 ?all"
mydomain.com.       1800    IN  TXT "v=spf1 include:amazonses.com include:_spf.google.com ip4:1.2.3.4 ?all"

I already allowed several dails for changes to propagate, but gmail still keeps marking my emails as spam.

So lets sum it up:

  • The From: -header tld does not correspond with the envelope domain, but the envelope domain does correspond with reverse dns and hostname of sending server (this is all amazon).

  • There are SPF and SenderId records set up that correspond to the From: -header.

  • Gmail keeps marking mail as spam.

Can anyone point me in the right direction?

share|improve this question
1  
"bla" as subject and content of "sers"? You might just be hitting a wall content-wise. –  ceejayoz Apr 19 '12 at 16:53
    
ok... that might actually be the case! thx +1 –  The Shurrican Apr 19 '12 at 16:56
add comment

3 Answers

Well, I don't know about anyone else, but Amazon's SES is in my spam filters as a persistent and unrepentent source of spam, and the service does nothing to help me to identify which users of the service are legit and which ones aren't. Not saying that's why gmail's calling a spade a spade, but it probably isn't helping.

share|improve this answer
    
thanks, +1. maby it is just due to the simple fact. or maby a specific amazon server that is used for my emaisl is on a spam list... well such things would be precisely the reason why in wanted to go for that service in the first place, but seems like that was a dead end. –  The Shurrican Apr 19 '12 at 16:33
add comment

SPF records aren't the only factor that is used when determining a message is spam. Gmail for example looks at DomainKeys / DKIM. See http://mailchimp.com/about/authentication/ for more information on the different email services and the different authentication techniques they use.

Looking at the headers in your email, SPF passed fine.

So you may want to look at implementing DomainKeys / DKIM for your emails. In Gmail, this would show a "Signed by" line in the details of the header.

Further to that, the content of the email also would have an impact. Doesn't matter whether Gmail believes the email is a genuine email, it may still flag your email as spam based on user feedback, content and other factors.

share|improve this answer
    
thanks, +1. i will implement dkim –  The Shurrican Apr 20 '12 at 12:27
add comment

I have found all email originating from Amazon's EC2 IP ranges to be weighted heavily as Spam by most recipients, even with Reverse DNS and other anti-spam settings. I relay through external servers for anything important because of this. It is a major drawback to AWS.

share|improve this answer
1  
SES e-mails don't come from the EC2 IP range. EC2 IPs being blacklisted is one of the main reasons Amazon has the SES service. –  ceejayoz Apr 19 '12 at 17:30
add comment

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.