Mail function to send message in HTML format
Posted: Thu Oct 21, 2004 7:38 am
Hello,
I'm trying to send the Email of an feed back form and I want the receipent to recieve the mail in an HTML format. I mean I'm trying to display the results in the table format. But with the below code, the reciepents email is showing the HTML code for the table rather than the table. ANy help is really appreciated.
I'm trying to send the Email of an feed back form and I want the receipent to recieve the mail in an HTML format. I mean I'm trying to display the results in the table format. But with the below code, the reciepents email is showing the HTML code for the table rather than the table. ANy help is really appreciated.
Code: Select all
html>
<head>
<title>feed</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<body>
<div align="center">
<p><font color="#0000FF" size="3" face="Arial, Helvetica, sans-serif"><strong>Feed
Back PHP Page</strong></font><font color="#0000FF" face="Arial, Helvetica, sans-serif"><strong></strong></font>
</p>
</div>
<?php
$t1 = $_POST["tf1"];
$t2 = $_POST["tf2"];
$t3 = $_POST["tf3"];
$message="";
$mailsubject = " Feedback from customer";
$mailbody = " <html><head></head><body>The user entered the following:\n";
$mailbody.="<table width="50%"><tr><td> The Users Name is " .$t1."\n</td></tr>";
$mailbody.=" <tr><td>The Users Emp# is " .$t2."\n</td></tr>";
$mailbody.=" <tr><td>The Users Phone is " .$t3."\n</td></tr></table>";
$mailbody.=" Have a nice day</body></html>";
$email ="makhalid143@yahoo.com";
$result = mail($email,$mailsubject,$mailbody);
if ( $result)
{
echo "<p> EMail sent to Khalid</p>";
}
else
{
echo " <p>Email could not be sent</p>";
}
?>
</body>
</html>