I always struggle when using headers along with the PHP mail() function. The problem is always the same, last year, this time, as long as I remember, it drives me mad.
The problem is that the headers are simply displayed in the email message.
Example received mail :
http://nl.tinypic.com/view.php?pic=63va5z&s=8#.U8PmeED8rbw
Source :
$onderwerp = "Bedankt voor uw bestelling met order nummer # ".$row['id'];
$ontvanger = "customer@customer.be";
$reply = "reply@reply.be";
//$reply = htmlspecialchars($_POST['je_email']);
$headers = "Content-type: text/html; charset=iso-8859-1\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Reply-To: Webmaster < reply@website.be >\r\n"; // reply-adres
//$headers .= "Cc: webmaster@website.be , crewlid@website.be \r\n"; //copy
//$headers .= "Bcc: crew@website.be \r\n"; // blind copy
$headers .= "From: TEST SOME NAME | GW8 <$reply>\r\n"; // de afzender van de mail
$headers .= "X-Mailer: PHP/" . phpversion() . "\r\n";
$headers .= "X-Priority: 1\r\n"; // 3 voor onbelangrijk
$headers .= "Priority: Urgent\r\n";
$headers .= "Importance: High\r\n"; // Low voor onbelangrijk
$headers .= "X-MSMail-Priority: High\r\n"; // Low voor onbelangrijk
$bericht = "<strong>TEST</strong>";
mail($ontvanger,$onderwerp,$bericht,$headers);
Which snippet I use, always the same problem.. Headers displayed in email content, as shown in screenshot.
Does anybody know how I can fix this ? I have a strong feeling this is a server-side problem..