Hi,
I’m using the mail() function to send emails from a contact form on a php site. It works perfectly for hotmail and yahoo addresses but not my work address (nothing arrives, ever) It doesn’t go to a junk or spam type folder either.
Is there a parameter I’m missing or something I should be adding to ensure it is treated as mail correctly by my work email server?
Or is there a better function I can use?
The code I’m using is:
$ip = $_POST['ip'];
$httpref = $_POST['httpref'];
$httpagent = $_POST['httpagent'];
$visitor = $_POST['txt_Name'];
$visitormail = $_POST['txt_Emailaddress'];
$notes = $_POST['txtarea_Message'];
if (eregi('http:', $notes)) {
die ("Sorry, this action is not allowed. If you feel this is a mistake, please <a href='mailto:contact@davidlavery.co.uk' class='textLink'>email us</a> directly.");
}
if((!strstr($visitormail,"@") || !strstr($visitormail,"."))) {
$badinput = "Fail";
}
$toAddress = 'derek.smith@mywork.com';
$subject = "Website query";
$todayis = date("l, F j, Y, g:i a") ;
$notes = stripcslashes($notes);
$message = " $todayis \
\
Message: $notes \
From: $visitor ($visitormail)\
";
$from = "From: ".$visitormail."\\r\
";
if(($visitor != "") && ($visitormail != "") && ($notes != "") && ($badinput != "Fail")) {
mail($toAddress, $subject, $message, $from);
Many thanks for your help,
Des