Well, I think the reason you get a blank one is because when you initially load the page, there are no post vars, so you get a blank email.
If you're wanting it to post back to itself, do this:
<?php
if(isset($_POST['name']))
{
$message = $fromname." sent you the following message:
============================
". $_POST['message'] ."
============================
The users info is:
IP: ". $_SERVER['REMOTE_ADDR'] ."
Host: ". gethostbyaddr($_SERVER['REMOTE_ADDR']);
$fromname = $_POST['name'];
$fromaddress = $_POST['email'];
$headers = "MIME-Version: 1.0\n";
$headers .= "Content-type: text/plain; charset=iso-8859-1\n";
$headers .= "X-Priority: 3\n";
$headers .= "X-MSMail-Priority: Normal\n";
//$headers .= "X-Mailer: php\n"; // Not really needed, possibly why it's marked as Junk
$headers .= "From: \"".$fromname."\" <".$fromaddress.">\n";
// Dealing with redirecting based upon successful mail()
if(mail("tombeers@msn.com", $_POST['subject'], $message, $headers))
{
// Mail was successfully sent
header('Location: contactsuccess.php');
}
else
{
// Mail was not successfully sent
echo 'Mail was not delivered';
}
}
else
{
?>
<form action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post">
<!-- Form elements here -->
</form>
?>
~Brett