Tried looking on here but wasn't able to resolve me issue. Trying to use php to send an HTML email, the e-mail sends out but when I get the e-mail all it does is display the actual html code. I tried different header code but it still will not display correctly. Any help would be awesome! I a sure its pretty simple and I am just missing something easy.
<?php
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-type: text/html; charset=iso-8859-1";
$headers = "From: [email protected]\n";
$headers .= "Reply-To: " . $_POST["email"] . "\n";
$headers .= "Return-path: " . $_POST["email"];
$sendTo = "[email protected]";
$subject = "Pex Heat Estimate Request from Customer {$_POST['custname']}-{$_POST['ProjectName']}:";
$message = "Here is a your Copy of Pex Heat Estimate Request from Customer {$_POST['custname']}-{$_POST['ProjectName']}";
$message .= '<html><body><table>';
foreach ($_POST as $key => $value) {
if (!is_array($value)) {
$message .= '<tr><td>' . $key . '</td><td>' . $value . '</td></tr>';
}
else {
foreach ($_POST[$key] as $itemvalue) {
$message .= '<tr><td>' . $key . '</td><td>' . $itemvalue . '</td></tr>';
}
}
}
$message .= '</body></table></html>';
mail($sendTo, $subject, $message, $headers);
?>
Thanks to @fred for the fix! - I was now able to start adding html tags, etc. my last question is how to I add a : after $key - Just trying to format the e-mail a bit better to distinguish between the column with the label and the actual data on the right.
<?php
$headers = "MIME-Version: 1.0\n";
$headers .= "Content-type: text/html; charset=iso-8859-1";
$headers .= "From: [email protected]\n";
$headers .= "Reply-To: " . $_POST["email"] . "\n";
$headers .= "Return-path: " . $_POST["email"];
$sendTo = "[email protected]";
$subject = "Pex Heat Estimate Request from Customer {$_POST['custname']}-{$_POST['ProjectName']}:";
$message = "Here is a your Copy of Pex Heat Estimate Request from Customer {$_POST['custname']}-{$_POST['ProjectName']}";
$message .= '<html><body><p>Thank you for submitting your Estimate Request with Pexheat.com : <u></u><u></u> Please remember to fax or email a floor plan diagram to us at 631-382-8225 or <a href="mailto:[email protected]" target="_blank">[email protected]</a>.<u></u><u></u></p>
<p>- Pexheat.com Staff</p><br></br><div>
<center><p align="center"><h3><strong>Pexheat.com Estimate Request</strong></h3><u></u><u></u></p></center><br></br>
</div><table width="80%" align="center">';
foreach ($_POST as $key => $value) {
if (!is_array($value)) {
$message .= '<tr><td>' . $key . '</td><td>' . $value . '</td></tr>';
}
else {
foreach ($_POST[$key] as $itemvalue) {
$message .= '<tr><td>' . $key . '</td><td>' . $itemvalue . '</td></tr>';
}
}
}
$message .= '</table></body><div><h5 align="center">Pexheat.com, 30 South Ave, Smithtown, NY 11787, Phone 631-240-9173, Fax 631-382-8225 | email: <a href="mailto:[email protected]" target="_blank">[email protected]</a>, Website: <a href="http://www.pexheat.com/" target="_blank">www.pexheat.com</a></h5></div></html>';
mail($sendTo, $subject, $message, $headers);
?>
$headers = "From: [email protected]\n";so do$headers .= "From: [email protected]\n";while deleting the one in$headers .= "MIME-Version: 1.0\n";so$headers = "MIME-Version: 1.0\n";has been answered- Do not modify your original question and add something after the fact.