Send mail using PHP
Posted: Tue Jul 17, 2007 11:23 pm
This code does not work on localhost. I want to run it successfully on the local server even.
Can anyone help or guide me what do i do next?
Regards,
Dream2rule
Can anyone help or guide me what do i do next?
Code: Select all
$to = "$email";
$subject = "Password Recovery";
$message = "<table width='65%' align='center' cellpadding='0' cellspacing='0' border='1'>
<tr><td>
<table width='100%' align='center' border='0' cellpadding='0' cellspacing='0'>
<tr>
<td height='22' bgcolor='#990033'><span class='style1'></span></td>
</tr>
<tr>
<td height='29'><span class='style1'> Dear $row[1], </span></td>
</tr>
<tr>
<td height='58'><span class='style1'> Thanks for registering with us. Your lost password has been recovered.
<p>Your details are as listed below: </p>
<p class='style1'>Username: $row[1]</p>
<p class='style1'>Password: $row[2]</p>
<p class='style1'>Hope you enjoy your stay with us!</p>
</span></td>
</tr>
<tr>
<td height='29'><span class='style1'> Thanks, </span></td>
</tr>
<tr>
<td height='21'><span class='style1'> Administrator </span></td>
</tr>
<tr>
<td height='21' bgcolor='#990033'> </td>
</tr>
</table>
</td></tr></table>";
// To send HTML mail, the Content-type header must be set
$headers = 'MIME-Version: 1.0' . "\r\n";
$headers = 'Content-type: text/html; charset=iso-8859-1' . "\r\n";
$headers = "From: admin@something.com";
mail($to, $subject, $message, $headers);
exit("<br><font face=arial,verdana size=2><b>A mail has been sent to your email id. Thankyou!</b></font><br>");Dream2rule