I am trying to use this code to get and email who wants to contact us. It is not giving me any error message but also not working when I submit information in form
<?php
$to = 'myemail@me.com';
$from = 'myemail@me.com';
//Check if we have something POSTed by the form.
if (isset($HTTP_POST_VARS)){
//Start with an empty body for the mail message
$body = '';
//Iterate through all the POSTed variables, and add them to the message body.
while (list($key, $value) = each($HTTP_POST_VARS)){
if( $key != "Submit" )
$body .= $key . ' = ' . $value . "\r\n";
}
//Build up some nice From/Reply Headers
$headers = "From: $from\r\n";
$headers .= "Reply-To: $from\r\n";
//Mail the message out.
$success = mail($to, "Web Site Email Message ", $body, $headers);
//Always check return codes from functions.
if ($success){
print "<meta http-equiv=\"REFRESH\" content=\"0; ";
print "formconfirm.html\">";
}
else{
$td=getdate();
$fname = "mailerror${td['year']}-${td['mon']}-${td['mday']}-${td['hours']}-${td['minutes']}-${td['seconds']}.txt";
$fp = fopen ("$fname","w");
fwrite ($fp, "$body");
fclose ( $fp );
print "<meta http-equiv=\"REFRESH\" content=\"0; ";
print "URL=/\">";
}
}
?>