Problem with mail()
Posted: Tue Jun 14, 2005 10:01 am
I have the follow code, which is suppose to take data from a form and send it in an email. Everything seems to work, the form submits, the page runs with no errors and even my little bit of error checking says the mail was sent. But the mail is never received. I've used formmail.pl and other prewritten script for this as well and I have the exact same problem. Any ideas?
Code: Select all
<?php
$message = '';
echo "POST/GET Variables: <br>";
foreach ($_POST as $key => $val)
if ($key != "recipient" && $key != "redirect" && $key != "print_config" && $key != "required" && $key != "Submit")
$message .= "$val<br>";
$header = "From: ";
$header .= $email;
$header2 = "-f";
$header2 .= $email;
echo "$message";
$ok = mail($recipient, $subject, $message, $header, $header2);
if ($ok) {
echo "Mail succesfully sent to: ".$recipient;
} else {
echo "Error: Unable to send mail to: ".$recipient;
}
?>