PHP mail() Intermittent Failure


#1

I have a registration form that sends e-mail to the registrant and a registrar. The form worked a year ago and it’s time to put the form up again and mail (via PHP’s mail function) is only being received intermittently.

I’ve also tried sending e-mail from the command line and mailq shows it leaves the local server but, it never seems to make it to the recipient.

I’ve seen a post making reference needing to use authentication with SMTP now.

Since mail has been received intermittently, I’m assuming the PHP is still good. Has the SMTP setup changed?!?


#2

Intermittent reception could be due to a number of factors.

As for SMTP, many mail servers are complying more closely with specifications (after decades of being overly lenient) and using SMTP can help get mail through the checks and balances.

The first thing to check is that the From: field is populated with the address that is actually sending the email, e.g. realmail@yourdomain.com. DKIM and SPF records will help get your mail through the various filters on it’s path to the recipient. Even after doing everything you possibly can, mail might still be winding up in Spam folders - so use test accounts at bulkies like hotmail and GMail to verify.


#3

The SMTP server in question is the one of the web server the site is located on. The mail would be being sent by apache but, the from is populated with a verifiable address. Seems I should update the code to use mail.mydomain.com and add DKIM and SPF records.