Hello:
I wrote a function to send an email. When I call the function in my script and run the script, I do not receive an email.
Can someone take a look and see what I did wrong?
This is the function php file: clsEmail.php:
<?php
function ConfirmEmail()
{
$to = $email;
$subject = 'Request For Information';
$message = "
<html>
<head>
<title>Confirmation</title>
</head>
<body>
<p>Your request for information was submitted. A representative will contact you to discuss your business needs.</p>
<table width=\"100%\" border=0>
<tr>
<td width=\"20%\"><b>Contact Name:</b></td><td>$name</td>
</tr>
<tr>
<td width=\"20%\"><b>Email Address:</b></td><td>$email</td>
</tr>
<tr>
<td width=\"20%\"><b>Message:</b></td><td>$comment</td>
</tr>
</table>
</body>
</html>
";
// 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";
// Additional headers
$headers .= 'From: MetalRoofingTools.com <info@summitwebcrafters.com>' . "\r\n";
//$headers .= 'Cc: info@summitwebcrafters.com' . "\r\n";
//$headers .= 'Bcc: info@summitwebcrafters.com' . "\r\n";
// Mail it
mail($to, $subject, $message, $headers);
}
?>
====================
This is the script which calls the funciton:
<?php
include ('header.php');
?>
<?php
$name=$POST["name"];
$email=$POST["email"];
$comment=$_POST["comment"];
include ('clsEmail.php');
ConfirmEmail();
?>
<table border="0" cellpadding="0" cellspacing="0" style="border-collapse: collapse" bordercolor="#111111" width="100%" id="AutoNumber8">
<tr>
<td width="4%"> </td>
<td width="62%"> </td>
</tr>
<tr>
<td width="4%"> </td>
<td width="62%"><b><font face="Verdana" size="4" color="#800000">
CONFIRMATION</font></b></td>
</tr>
<tr>
<td width="4%"> </td>
<td width="62%"> </td>
</tr>
<tr>
<td width="4%"> </td>
<td width="62%">
<p align="left"><font face="Verdana" size="2">Thank you for
contacting MetalRoofingTools.com. Your request for information
was submitted.</font></p>
<p align="left"><font face="Verdana" size="2">A representative will
contact you to discuss your needs. A confirmation email was
sent to you.</font></p>
<p>
<?php
echo "<table border='0' width='60%'>";
echo "<tr>";
echo "<td width='40%'><b><font size='2' face='Verdana'>";
echo "Contact Name:</font></b></td>";
echo "<td width='60%'><font size='2' face='Verdana'>";
echo $name;
echo "</font></td></tr>";
echo "<tr>";
echo "<td width='40%'><b><font size='2' face='Verdana'>";
echo "Email Address:</font></b></td>";
echo "<td width='60%'><font size='2' face='Verdana'>";
echo $email;
echo "</font></td></tr>";
echo "<tr>";
echo "<td width='40%'><b><font size='2' face='Verdana'>";
echo "Message:</font></b></td>";
echo "<td width='60%'><font size='2' face='Verdana'>";
echo $comment;
echo "</font></td></tr>";
echo "<tr>";
echo "<td width='40%'><b><font size='2' face='Verdana'>";
echo "</td>";
echo "<td width='60%'>";
echo "</td></tr>";
echo "</table>";
?>
</p>
<p align="left"> </td>
</tr>
<tr>
<td width="4%"> </td>
<td width="62%"> </td>
</tr>
</table>
<p align="left">
</td>
<td width="3%" height="294"> </td>
</tr>
</table>
</td>
</tr>
<?php
include ('footer.php');
?>
Thank you in advance.