I have a PHP script that I use to create and send email messages from an HTML form, it works fine under a Unix host, but when I run it under a Linux host all the code runs fine except for the mail() function, it returns back a false completion code and no email gets sent. I talked with the Linux hosting techs and they said everything was enabled and the sendmail_path and switches were set OK. ( /usr/sbin/sendmail -t -i ).
Can anyone help me with why the mail() doesn't work under the Linux host?
<?
if (empty ($name)) {
echo "<br><center><b><font size=+1 color=red>Please input correct Name!</font></b></center>";
exit; }
$pattern = ".+@.+..+";
if (!eregi ($pattern, $email)) {
echo "<br><center><b><font size=+1 color=red>Please input correct Email address!</font></b></center>";
exit; }
$message = "You have received an inquiry from your WebSite. \n";
$message = $message.date('j M Y, H:ia')."\n";
while ($element = each ($_POST))
{
if ($element["key"] == "Subject") continue;
if ($element["key"] == "MailTo") continue;
if ($element["key"] == "MailFrom") continue;
if ($element["key"] == "ReDirect") continue;
if ($element["key"] == "Reply_Message") continue;
$message = $message."\n".$element["key"].": ====> ". $element["value"];
}
if (mail ($MailTo, $Subject, $message, "from: $email")) {
echo "<center><br><font size=+1 color=red><b>Your Registration was successfully sent.<br>You will recieve a response back within 24 hours, <br>Thank You for using our WebSite!</b></font></center>";
} else {
echo "<center><br><font size=+1 color=red><b>There was an email send problem....Your message was not sent. </font></b>";}
?>