Hello,
Whenever our php app sends emails with proper html headers, the headers don’t seem to be transmitted properly and all email is treated as text.
Here’s the BODY of a test email my sent from our php app:
Content-type: text/html; charset=iso-8859-1
X-Mailer: PHP/5.2.4-2ubuntu5.10
Message-Id: <20100428232815.85BDB3E001@**********************>
Date: Wed, 28 Apr 2010 16:28:15 -0700 (PDT)
Test Email
Sender: System LVSYS
Recipient: **********************
See? Outlook is showing the headers in the body of the email…
Note: the PHP code in question is not faulty. There’s no extra newline that’s misplaced. and to prevent diverging the discussion, here’s what we’ve used to reproduce the bug:
<?php
// --- CONFIG PARAMETERS --- //
//
$email_recipient = "*****@lvsys.com";
$email_sender = "System LVSYS";
$email_return_to = "*****@lvsys.com";
$email_content_type = "text/html; charset=iso-8859-1";
$email_client = "PHP/" . phpversion();
//
// ------------------------- //
// — DEFINE HEADERS — //
//
$email_header = "From: " . $email_sender . “\r\n”;
$email_header .= "Reply-To: " . $email_return_to . “\r\n”;
$email_header .= "Return-Path: " . $email_return_to . “\r\n”;
$email_header .= "Content-type: " . $email_content_type . “\r\n”;
$email_header .= "X-Mailer: " . $email_client . “\r\n”;
//
// ---------------------- //
// — SUBJECT AND CONTENTS — //
//
$email_subject = “Test email subject”;
$email_contents = “”;
$email_contents .= “
Test Email
”;
$email_contents .= "
Sender: " . $email_sender;
$email_contents .= "
Recipient: " . $email_recipient;
$email_contents .= “”;
//
// ---------------------------- //
$email_result = mail($email_recipient, $email_subject, $email_contents, $email_header);
if ($email_result) echo “Email has been sent!”;
else echo “Email has failed!”;
?>
NOTE: the extra stars (*) in both snippets are here to anonymize our data for this forum.
What do I need to do to get the postfix smtp server to handle those headers properly?
Thanks for any help
MD