Hello Experts!
I am using the PHP mail() function to sumbit a form from the website to the client email. The email looks perfect on a Linux mailbox, but received by an Exchange mailbox, I don't see the correct FROM information, and I can see all the html tags inside the email. I am pasting my code below.
Looking forward to your suggestions!!
<?php
$message1 = stripslashes("
<html>
<head>
<title>Communication from website</title>
</head>
<body>
<table border='0' cellpadding='1' cellspacing='1'>
<tr align='left'><td colspan='2'><font size='+1'><b>Contact Us form from website</b></font><br><br>
</td></tr>
<tr><td align='right' class='gray12' valign='top'>First Name: </td><td>$first
_name</td>
</tr>
<tr><td align='right' class='gray12' valign='top'>Last Name: </td><td>$last_
name</td><
/tr>
<tr><td align='right' class='gray12' valign='top'>Company: 
;</td><td>
$Company</
td></tr>
<tr><td align='right' class='gray12' valign='top'>Street Address: </td><td>$St
reet</td><
/tr>
<tr><td align='right' class='gray12' valign='top'>State: <
/td><td>$s
tate0</td>
</tr>
<tr><td align='right' class='gray12' valign='top'>Zipcode: 
;</td><td>
$zipcode $plusfour</td></tr>
<tr><td align='right' class='gray12' valign='top'>Email: <
/td><td>$z
ipcode $email</td></tr>
<tr><td align='right' class='gray12' valign='top'>Phone: <
/td><td>$p
hone</td><
/tr>
<tr><td align='right' class='gray12' valign='top'>Interested:&n
bsp;</td><
td>$Intere
sted</td><
/tr>
<tr><td align='right' class='gray12' valign='top'>Comments:&nbs
p;</td><td
>$comments
</td></tr>
</table>
</body>
</html>
");
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers .= 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers .='From: '.$fname. ' '.$lname.'<'.$email.'>' . "\r\n";
$subj='Contact Us form from website';
//$from = "From: \"$fname $lname\" <$email>\nX-Mailer: PHP/" . phpversion;
mail('test@bscny.com', $subj, $message1, $headers);
?>
Start Free Trial