Question

I have set up an AJAX contact form on a client's website.

The problem is that the email is not getting through to the client's inbox.

I set up the client with Google Apps (in the same way I did for myself).

I used the same contact form with my email address and it works. But with any email addresses on their domain it doesn't!

All members of the domain are receiving 'ordinary' emails.

What could be the difference that's stopping mail() emails getting through?


UPDATE

Ok so I managed to solve it. Turns out that using a CNAME to point the domain to the correct server wasn't enough for sendmail so I had to change it to an A record pointing directly to the server. Strange but true. Thanks for the help folks, you pointed me in the right direction :)

Was it helpful?

Solution

It depends on the both settings on your server and the server on the receiving end.

hotmail for example requires the use of correctly configured SPF records.

many mail-receiving servers (including hotmail) require the email to originate from a Fully Qualified Domain Name. It is very possible that your e-mails send from PHP do not comply with this rule. (there is a good chance they originate from 'apache')
see hotmail self help and hotmail postmaster info

PHP's mail() function does not include a lot of headers with your mail, so you will need to supply them yourself.

The more hops your mail makes on it's way to it destination, the more likely it is to be tagged as spam. So it might be a better option not to use PHP's mail function and instead use a mail library that connects to an SMTP server just like your desktop mail application does.

All in all, I would place my bets on an external library: Pear::Mail (documentation)

You could also read: how do you make sure email you send programmatically is not automatically marked as spam

UPDATE
Failing the SenderId or SPF check can get your message dropped before it even hits the users inbox. The message will not end up in the users junk folder, it will go directly to /dev/null. I know this is at least true for hotmail and live mail. I see no reason for other hosts not to have implemented the same policy.

OTHER TIPS

I recommend using PHPMailer (including their SMTP) library instead. It is reliable compared to mail and allows you to create fully customized emails.

http://phpmailer.worxware.com/

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top