AOL Rejecting email sent via PHP mail (error 5.2.1)

SteveJarvis picture SteveJarvis · Jul 23, 2014 · Viewed 16.5k times · Source

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

Answer

waza-ari picture waza-ari · Jan 30, 2015

To the best of my knowledge, AOL indeed rejects mails, which either claim to be from AOL (FROM header, DMARC), or mails, which are not from AOL, but use an AOL address as Reply-To header. However, I cannot say whether this is due DMARC or not. I hence can confirm what Steve is saying, I noticed the same behavior in my application.

As soon as the Reply-To header is removed or changed to a non-AOL address, the mail is delivered correctly. It is however interesting to note, that only the AOL customer which is put in the Reply-To field does not receive the mail. If there are other AOL-mails in the TO header, those delivered and not blocked.

I mentioned that I am not sure, whether they reject it due to DMARC or not. An interesting hint can be found at the AOL postmaster blog introducing DMARC. Here it is explicitly recommended to use the Reply-To line and put the actual address in there. Further, mails rejected to a failed DMARC check are normally rejected using an error code noting the failed DMARC check.