This should be pretty straightforward. I'm sending an email using an Angular JS's HTTP object ajax request.
The ajax request works fine, my data is passed to the PHP in JSON format (The Angular JS default).
The email sends correctly, I'm just having issues with my header formatting. I have the following PHP code...
$postdata = file_get_contents("php://input");
$request = json_decode($postdata);
$user_email = $request->email;
$user_subject = $request->subject;
$user_message_input = $request->message;
$user_headers = 'From: ' . '<noReply@AllenHundley.com>' . '
';
$user_headers .= "MIME-Version: 1.0
";
$user_headers .= "Content-Type: text/html; charset=ISO-8859-1
";
$user_message = "
<html>
<head>
<title>
Thanks for contacting me!
</title>
</head>
<body>
" . $user_message_input . "
</body>
</html>
";
mail($user_email, $user_subject, $user_message, $user_headers);
As I mentioned before, the email sends as an HTML email. The only problem is that in my email I receive this as the from field:
rnMIME-Version: 1.0 noReply@allenhundley.com
Why are the separations being viewed as escaped strings rather than separators?