开发者

Email not sent or not working?

I need to ask a simple question to anyone. Any clue will be much appreaciated!

Could you please tell me any reason why a p开发者_开发知识库hp mail() may not be sent?

I am pretty sure all details entered are correct from $to to $headers etc.

Please, Francesco

Code is:

<?php  
if (array_key_exists('sendEmail', $_POST)) {


    $to = 'my@email.com,'.$_POST['email'].''; 

    $subject = 'bla bla';  

    $headers = 'From: my@email.com>\r\n"  

        ."Reply-To: $email';  

    $message = 'Dear '.$_POST['name']."\r\n\r\n"; 

    $message .= 'Your Booking Number is '.$_POST['ID']."\r\n";  

    $message .= 'Name ' .$_POST['title']. ' ' .$_POST['firstname']. ' ' .$_POST['lastname']."\r\n";  



    mail($to,$subject,$message,$headers); 

}

?>


Try enclosing the mail() method:

if(mail(...)) {
   echo "SUCCESS";
} else {
   echo "FAILURE";
}

The mail method will return false if transmission failed.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜