简体   繁体   中英

Php mail function issue

I'm trying to send a email to user after successfully register. So that following is my .php code.

$to = $email;                       
$subject = "Signup | Verification";
$message = "Congratulation $f_name $l_name you have been successfully registered. Please 
click the link to active your account.\r\n";
$message .= "http://www.maaks.fr/hotel/verify.php?email=$email&hash=$hash\r\n";

$from = "noreply@yoursite.com";
$headers = "MIME-Version: 1.0\r\n";
$headers .= "Content-rype: text/html; charset=iso-8859-1\r\n";
$headers .= "Content-Transfer-Encoding; 7bit\r\n";
$headers = "From:" . $from . "\r\n";

$sentmail = mail($to,$subject,$message,$headers);                   
if($sentmail)
{
header("Location: thankyou.php?member=successfully");
exit();
}

It doesn't sent a email to the user. I checked it that if $sentmail is ok then It's go thankyou page. But interesting matter is that it's go to thankyou page without sent a email.

Is there anything i forgot?

The mail() function returns true if the message was accepted for delivery, it doesn't mean the message will be delivered.

From the Manual :

Returns TRUE if the mail was successfully accepted for delivery, FALSE otherwise.

It is important to note that just because the mail was accepted for delivery, it does NOT mean the mail will actually reach the intended destination.

Your message is probably being blocked by the recipients spam filter or going straight to the junk folder.

There is one minor typo in your email message but I don't think it will solve your problem.

You have a Content-rype specified, you should change that to Content-type...

But again I don't think that will solve your problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM