PHP Mailto() - Google now displaying HTML as Plain Text

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]


Hi all,

I have been using a mailto() script for the last three years and from April
25, 2012 incoming HTML email in Goggle mail is displaying as Plain Text.
 Something clearly changed with Google. Perhaps there is some change I need
to make with my script??

// First set up some variables for recipient, subject, and date/time received
$to = $sendto;  // Recipient
$subject = "Message received via XXXXXXXXXX website";  // Subject
$oh = (int) date ("Z") / 3600;	// time offset to GMT
$date = date("d M Y g:i:s a ", mktime (date ("H") - $oh)). " GMT"; //
Date and time in the form yyyy-mm-dd hh:mm:ss


// Set up conditionals for optional fields
$addr1 = $_POST['addr1'];
$addr2 = $_POST['addr2'];
$city = $_POST['city'];
$country = $_POST['country'];
$postalcode = $_POST['postalcode'];

// Compose body of email
$message = "<p>Following is a message received for ".$recipient. "
sent via XXXXXXXXXXXXXX website on ".$date."</p>";
$message .= "<p><b>From:</b> ".$n." (".$email.")</p>";

if (($addr1) && (! $addr2)) {
$message .=  "<p><b>Address:</b> ".$addr1."</p>";
} elseif (($addr1) && ($addr2)) {
$message .=  "<p><b>Address:</b> ".$addr1.", ".$addr2."</p>";
} else {
$message .=  "<p><b>Address:</b> None provided</p>";}

if ($city) {
$message .= "<p><b>City:</b> ".$city."</p>";
} else { }

if (($country) && (! $postalcode)) {
$message .= "<p><b>Country:</b> ".$country."</p>";
} elseif($country && $postalcode) {
$message .= "<p><b>Country:</b> ".$country." ".$postalcode."</p>";
} else { }

$message .= "<p><b>Message:</b><blockquote> ".$m."</blockquote></p>";

// To send HTML mail, the Content-type header must be set
$headers  = 'From: '.$n.'<'.$email . ">\r\n" ;
$headers .= 'Reply-To: '.$email . "\r\n";
$headers .= 'cc: XXXXXXX <xxxxxxxx>' . "\r\n";
$headers .= 'Bcc: XXXXXXX <xxxxxxxx>' . "\r\n";

// Additional headers
$headers .= 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .= 'X-Mailer: PHP/' . phpversion();


// send email
mail($to, $subject, $message, $headers);


Thanks
-- 
*Terry Ally*

[PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [Find Someone]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux