phpemailemail-headersaol

AOL Rejecting email sent via PHP mail (error 5.2.1)


Recently AOL has started rejecting emails sent from my production server.

Customers make product enquiries through my site and can "cc" themselves if they wish. I check for spam (e.g. don't send if request contains banned phrases, urls, etc). However, recently, if the enquirer is an AOL customer, the message bounces:

<*removed!*@aol.com>: host mailin-04.mx.aol.com[64.12.88.132] said: 521 5.2.1 :
    AOL will not accept delivery of this message. (in reply to end of DATA
    command)

Email protocol is not my area of expertise! I just use the standard PHP mail() function and this has worked ok for years.

I have looked through the AOL Postmaster support pages and contacted AOL (which, obviously, was my first port of call - but they have yet to respond), plus I don't really understand the problem (which is 50% of finding the solution!).

http://postmaster-blog.aol.com/2014/04/22/aol-mail-updates-dmarc-policy-to-reject/

...it seems as though AOL are saying "we don't like the way that you send emails, sorry to inconvenience you..."

If anyone has any experience or specific insight into how to get AOL to accept emails then I would love to hear from you. I'm guessing that it could be something to do with how my emails are formed: this hasn't changed in years and (previously) I've had no reason to look at the code:

Here is an edited version of how I send emails...

$recipient = "\"$supplier[supplierName]\" <$supplier[supplierEmail]>";
$subject = "$supplier[supplierName] enquiry";
$headers = "MIME-Version: 1.0".PHP_EOL ;
$headers .= "Content-type: text/html; charset=utf-8".PHP_EOL;
$headers .= "Reply-To: \"$cleanArrayEmail[realname]\" <$cleanArrayEmail[email]>".PHP_EOL;
$headers .= "From: \"Admin\" <ADMIN_EMAIL>".PHP_EOL;
if ($_POST['cc']){$headers .= "cc: \"$cleanArrayEmail[realname]\" <$cleanArrayEmail[email]>".PHP_EOL;}

mail ($recipient, $subject, $msg, $headers, '-f'. ADMIN_EMAIL );

Many thanks Steve


Solution

  • AOL recently implemented DMARC Rejection, as did Yahoo before them. What this means is that if your PHP code attempts to send an email that claims to be FROM a Yahoo.com or AOL.com address, it will not be accepted by the recipients mail server, be it AOL, Yahoo, Gmail, or anyone else that supports DMARC.

    Look at your email FROM address, is it AOL or Yahoo? If so then DMARC may be your problem, if not than it's probably something else. DMARC policies are set in DNS records for every domain, you can use this tool to check the DMARC policy for your FROM domain.

    https://dmarcian.com/dmarc-inspector/aol.com