I am using PHP 7.0.12 on a Windows 2012 R2 server. I have an SMTP server set up with IIS6.
I am using PHP's mail() function to send emails. This works as expected for most email addresses but not all.
With some email addresses, I receive a Delivery Status Notification (Failure) email with the following error:
Reporting-MTA: dns;domain.net
Received-From-MTA: dns;Server
Arrival-Date: Mon, 16 Jan 2017 17:40:58 +0000
Final-Recipient: rfc822;someone@somedomain.com
Action: failed
Status: 5.6.0
Diagnostic-Code: smtp;550 5.6.0 Lone CR or LF in headers (see RFC2822 section 2.2)
The headers that I am sending are:
$headers = "From: " . "noreply@domain.net" . "
";
$headers .= "MIME-Version: 1.0". "
";
$headers .= "Content-Type: text/html; charset=ISO-8859-1" ."
";
I have also tried to use PHP_EOL.
So, this is what I'm doing:
mail("someone@somedomain.com", "test email", "Conrads test", $headers);
I have spent hour's looking for answers but have had no success - If someone could please advise as to how to resolve this, that would be great :)
Thanks.