Hi all!
I'm having a problem sending an HTML email with PHP version 4.3.2.
The code worked with a previous version of PHP, but the client moved the site to another host, and now all we get is the HTML code in the received emails.
When we activate this code with a browser, the HTML part of it works fine, displaying the tables exactly as it should.
Here's the code that I'm trying to get to work... Any suggestions will be greatly appreciated!
<?php
$today = date("F j, Y, g:i a");
$message .= '
<html>
<head>
<title></title>
</head>
<body topmargin="0" leftmargin="0" marginwidth="0" marginheight="0" rightmargin="0" bgcolor="#ffcc33">
';
$message .= $today . ' <br><br>
<center>
<table border=0 width=400>
<tr bgcolor=#fb9905><td colspan=2>
Name: ';
$message .= $studentname . '
</td></tr>
<tr bgcolor=#fb9905><td colspan=2>
School, Org: ';
$message .= $comment3 .', ';
$message .= $comment4 . '
</td></tr>
<tr bgcolor=#fb9905><td colspan=2>
Comment2: ';
$message .= $comment2 . '
</td></tr>
<tr><td colspan=2>
<hr>
</td></tr>
<tr bgcolor=#fb9905><td>
Billing Name:
</td>
<td> ';
$message .= $NAME . '
</td></tr>
<tr bgcolor=#fb9905><td>
Billing Address:
</td>
<td> ';
$message .= $ADDRESS . '
</td></tr>
<tr bgcolor=#fb9905><td>
City:
</td>
<td> ';
$message .= $CITY . '
</td></tr>
<tr bgcolor=#fb9905><td>
State:
</td>
<td> ';
$message .= $STATE . '
</td></tr>
<tr bgcolor=#fb9905><td>
Zip:
</td>
<td> ';
$message .= $ZIP . '
</td></tr>
<tr bgcolor=#fb9905><td>
Phone:
</td>
<td> ';
$message .= $PHONE . '
</td></tr>
<tr bgcolor=#fb9905><td>
Email:
</td>
<td> ';
$message .= $EMAIL . '
</td></tr>
</td></tr>
</table>
</center>
</body>
</html>
';
$message .= "--".$mime_boundary."\r\n";
$subject = "Portrait Order";
$to_email = "robophobic@hotmail.com";
$headers = "From: $EMAIL\n";
$headers .= "MIME-Version: 1.0\r\n";
$boundary = uniqid("HTML");
$headers .= "Content-Type: multipart/alternative" .
"; boundary = $boundary\r\n\r\n";
$headers .= "This is the message if their email client can't deal with mime\r\n\r\n";
$headers .= "--$boundary\r\n" .
"Content-Type: text/plain; charset=ISO-8859-1\r\n" .
"Content-Transfer-Encoding: base64\r\n\r\n";
$headers .= "This is the plain text version!";
$headers .= "--$boundary\r\n" .
"Content-Type: text/html; charset=ISO-8859-1\r\n" .
"Content-Transfer-Encoding: base64\r\n\r\n";
$headers .= "$message";
mail($to_email, $subject, "", $headers);
echo "Your data has been submitted";
echo $message;
?>