php mail function help needed
Posted: Sun Feb 19, 2006 4:01 am
Hi, I am having problems using the mail() function. It all seems to work fine, but the email is not delivered. Can any one help?
TIA
Azlan
Code: Select all
<?php
function checkOK($field){
if (eregi("\r",$field) || eregi("\n",$field)){
die("Invalid Input at $field");
}
}
//Create email message
$to = "me@email.com";
checkOK($to);
$subject = "New order";
checkOK($subject);
$message = "Order placed by ";
checkOK($message);
$from = "orders@email.com";
checkOK($from);
if(mail($to, $subject, $message, $from)){
echo "Message sent successfully.";
}else{
echo "Failed to send message.";
}
?>TIA
Azlan