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 have a website where people can recommend contents to their friends using their email. The issue is that emails are being flagged as spam whereas if I do the same from my development machine things are working out fine. I have enabled SPF and it is perfect.

When sending through website, the email appears as this in Gmail Inbox: From xyz@gmail.com to abc@gmail.com.

When I send it from my development machine it appears as : From xyz.com via mywebsite.com to abc@gmail.com mailed by mywebsite.com and this is exactly how I envisioned it.

From what little I could figure out by looking at the source of emails in Gmail is that when sending from my development machine Gmail correctly recognizes my domain as mywebsite.com for which SPF is enabled and hence it treats it as genuine email. Whereas Gmail recognizes my domain as mywebsite@ln5.securedhostdns.com when sent through the website. Can someone tell me why it does so?

Any help would be really appreciated.

share|improve this question

migrated from stackoverflow.com Jul 1 '11 at 14:18

This question came from our site for professional and enthusiast programmers.

    
Well, I'd guess that Google gives you a higher spam score for saying "this is from someone @gmail.com", but SPF for gmail.com doesn't match that. –  Piskvor Jul 1 '11 at 14:07
add comment

2 Answers

Google's antispam takes into account many more variables than just SPF records. You need to check with them to understand why your mail is being blocked. Start by reading their guidelines for bulk senders:

https://mail.google.com/support/bin/answer.py?hl=en&answer=81126

Then if you are still unsure contact their postmaster.

Make sure your domain has feedback loops setup with all the major destination mail providers as well, so you'll be notified of issues.

share|improve this answer
    
Thanks mfarver. I will do that. –  Asif Jul 1 '11 at 15:45
add comment
up vote 2 down vote accepted

I figured out where the problem was. So in case someone has the same problem, he can do this:

In php's mail function I was not specifying envelope-sender address and therefore php was defaulting it to something like this mywebsite @server.isp.com.

I specified it like this as an additional parameter : '-f mywebsite@mywebsite.com'

Now php mail function will look something like this: mail($toaddress, $subject, $mailcontent, $fromaddress, '-f mywebsite@mywebsite.com');

This solved my problem.

share|improve this answer
    
If this solved your problem, you should accept your answer –  Michael Lowman Jul 8 '11 at 15:14
    
@michael lowman I am new to this site. Will you tell me how to close this question. –  Asif Jul 8 '11 at 15:29
    
you should click the check mark next to this answer, and it will turn green. and welcome to serverfault :) –  Michael Lowman Jul 8 '11 at 15:36
    
@michael lowman Thanks. –  Asif Jul 8 '11 at 15:36
    
Thanks Asif, that really helped me out - I was getting emails arriving in gmail with 'via serverxx.hostingcompany.location.com' and the -f parameter was exactly what I needed. –  Dave Hilditch Apr 9 '13 at 16:17
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.