简体   繁体   English

PHP邮件功能问题

[英]Php mail function issue

I'm trying to send a email to user after successfully register. 成功注册后,我正在尝试向用户发送电子邮件。 So that following is my .php code. 因此,以下是我的.php代码。

$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. 我检查了一下,如果$ sentmail没问题 ,那就到了谢谢页面。 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. 如果邮件已被接受传递,则mail()函数将返回true ,这并不意味着邮件将被传递。

From the Manual : 手册

Returns TRUE if the mail was successfully accepted for delivery, FALSE otherwise. 如果邮件已成功接受传递,则返回TRUE,否则返回FALSE。

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... 您指定了Content-rype,应将其更改为Content-type ...

But again I don't think that will solve your problem. 但是我再次认为这不会解决您的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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