Paithar
11-06-2006, 09:41 PM
On another website I used PHP's mail function to mail a simple contact us type form to an admin person. Well, I have need of doing it with my current job. I created a simple contact us form and all it has to do is email it's contents to me (for testing of course).
Well, it's not returning any errors whatsoever but it's also not sending the email.
Here's the contact us form page... http://www.oasisgamingusa.com/testlayout/contactus_layout9.php
Here's the code for the actual page that has the mail function...
<?php
function handleform()
{
......... other code here ..........
} // end if action == 2
else
if(!$action)
{
// email the comments from the contactus page to
// the default email address
//$toaddress = "marketing@oasisgamingusa.com"
$toaddress="Sean.Meyer@oasisgamingusa.com";
// 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: website@oasisgamingusa.com\r\n";
$subject = "Comments/Inquiry";
$mailcontent = "
<html>
<head>
<title>Comment/Inquiry From Website User</title>
</head>
<body>
<table>
<tbody>
<tr>
<td colspan='2'><h1>Comment/Inquiry From Website User</h1></td>
</tr>
<tr>
<td><strong>Name:</strong></td>
<td>$name</td>
</tr>
tr>
<td><strong>Email:</strong></td>
<td>$email</td>
</tr>
<tr>
<td><strong>Phone:</strong></td>
<td>$phone</td>
</tr>
<tr>
<td><strong>Comments/Inquiry:</strong></td>
<td>$comments</td>
</tr>
</tbody>
</table>
</body>
</html>";
if(!mail($toaddress, $subject, $mailcontent, $headers))
{
echo "<p class='articlecontent'>There was an error submitting ";
echo "your comments. Please try again later.</p>";
exit();
}
echo "<p class='articlecontent'>Thank you! We appreciate your ";
echo "comments and will contact you back if needed.</p>";
}
}
?>
That code actually does some other stuff as well but the mail function code is in the lower half.
Anyone know if there's something else that needs to be set up and where I might found out how to set it up?
Anyone have any other ideas for me on what might be wrong?
Thanks
Well, it's not returning any errors whatsoever but it's also not sending the email.
Here's the contact us form page... http://www.oasisgamingusa.com/testlayout/contactus_layout9.php
Here's the code for the actual page that has the mail function...
<?php
function handleform()
{
......... other code here ..........
} // end if action == 2
else
if(!$action)
{
// email the comments from the contactus page to
// the default email address
//$toaddress = "marketing@oasisgamingusa.com"
$toaddress="Sean.Meyer@oasisgamingusa.com";
// 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: website@oasisgamingusa.com\r\n";
$subject = "Comments/Inquiry";
$mailcontent = "
<html>
<head>
<title>Comment/Inquiry From Website User</title>
</head>
<body>
<table>
<tbody>
<tr>
<td colspan='2'><h1>Comment/Inquiry From Website User</h1></td>
</tr>
<tr>
<td><strong>Name:</strong></td>
<td>$name</td>
</tr>
tr>
<td><strong>Email:</strong></td>
<td>$email</td>
</tr>
<tr>
<td><strong>Phone:</strong></td>
<td>$phone</td>
</tr>
<tr>
<td><strong>Comments/Inquiry:</strong></td>
<td>$comments</td>
</tr>
</tbody>
</table>
</body>
</html>";
if(!mail($toaddress, $subject, $mailcontent, $headers))
{
echo "<p class='articlecontent'>There was an error submitting ";
echo "your comments. Please try again later.</p>";
exit();
}
echo "<p class='articlecontent'>Thank you! We appreciate your ";
echo "comments and will contact you back if needed.</p>";
}
}
?>
That code actually does some other stuff as well but the mail function code is in the lower half.
Anyone know if there's something else that needs to be set up and where I might found out how to set it up?
Anyone have any other ideas for me on what might be wrong?
Thanks