I have this script which i use on my own website:
<?php
error_reporting(E_ALL);
$email_subject = "New Customer Registration AP-Photography";
$from = "registrations@aftab-photography.dpwebdev.co.uk";
$email_to = "david@dpwebdev.co.uk";
function clean_string($string) {
$bad = array("content-type","bcc:","to:","cc:","href");
return str_replace($bad,"",$string);
}
$email_message2 = "Hello! This is a automatic email message.";
$email_message2 .= "<BR>";
$email_message2 .= "<BR>";
$email_message2 .= "A New User has registered on aftab-photography.co.uk.";
$email_message2 .= "<BR>";
$email_message2 .= "<BR>";
$email_message2 .= '<td width="6%">Name:</td><td width="34%">'.clean_string($user_id).'</td>';
$email_message2 .= "<BR>";
$email_message2 .= "<BR>";
$email_message2 .= "Thanks";
$email_message2 .= "<BR>";
$email_message2 .= "Aftab-Photography";
$emailfrom = $from;
$emailto = "ap_photography@hotmail.co.uk";
// create email headers
$headers = 'From: '.$emailfrom."\r\n".
'Reply-To: '.$emailto."\r\n" .
'X-Mailer: PHP/' . phpversion();
@mail($email_to, $email_subject, $email_message2, $headers);
echo "Mail Sent";
}
?>
This is used to email me when a customer registers on my website however it doesn’t email me at all.
Any ideas?
David
BTW: I have a linux server with default installation.
Check the return value from mail(). If it is false, then there was a problem sending the mail. If true, then the mail was sent correctly and the problem would probably be in the mail address.
Check your php.ini to see what your default mailer program is, and how it is configured.
Check the mailer logs to see if the message is being queued/delivered correctly.