[英]mail function not working for yahoo mail id
I have written a code to send mail on yahoo or gmail.Mail is sending on gmail but im not seeing any message in yahoo mail. 我已经写了一个代码在yahoo或gmail上发送邮件。邮件正在gmail上发送,但是我在yahoo邮件中看不到任何消息。 And in gmail im seeing all html content with message.
并在gmail im中看到带有消息的所有html内容。 here is my code...
这是我的代码...
$headers = "From: \"".$from_name."\" <".$from_email.">\n";
$headers .= "To: \"".$to_name."\" <".$to_email.">\n";
$headers .= "Return-Path: <".$from_email.">\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-Type: text/HTML; charset=ISO-8859-1\n";
// message
$message = '
<html>
<head>
<title>Registration</title>
</head>
<body>
<table><tr>
<td> <a href="#'> Click Here To Activate Your account</a>
Thanks To visit site.com
</td>
</tr>
</table>
</body>
</html>';
if(mail('', $subject, $message, $headers))
echo "successfully register !! please check your mail and clik on confirmation link";
$to = $to_email;
$headers = "From: \"".$from_name."\" <".$from_email.">\n";
$headers .= "To: \"".$to_name."\" <".$to_email.">\n";
$headers .= "Return-Path: <".$from_email.">\n";
$headers .= "MIME-Version: 1.0\n";
$headers .= "Content-Type: text/HTML; charset=ISO-8859-1\n";
$message = <<<EOD
<html>
<head>
<title>Registration</title>
</head>
<body>
<table><tr>
<td> <a href="#'> Click Here To Activate Your account</a>
Thanks To visit site.com
</td>
</tr>
</table>
</body>
</html>
EOD;
if(mail($to, $subject, $message, $headers))
echo "successfully register !! please check your mail and clik on confirmation link";
try this instead of your message string 试试这个而不是你的消息字符串
You may want to use something like PHPMailer instead of trying to build a MIME message yourself. 您可能要使用PHPMailer之类的东西,而不是尝试自己构建MIME消息。 It hides all the ugly work of setting headers and whatnot, and all you do is provide the content.
它隐藏了设置标题和其他所有丑陋的工作,您要做的就是提供内容。
And in any case, assuming you built the mail properly, have you checked your mail server's outgoing log to see if the message even try to reach Yahoo's mail exchanger? 在任何情况下,假设您正确构建了邮件,是否检查邮件服务器的传出日志以查看邮件是否甚至试图到达Yahoo的邮件交换器? Just because the
mail()
function in PHP succeeded doesn't mean the email ever got out your front door. 仅仅因为PHP中的
mail()
函数成功并不意味着电子邮件就从您的前门中走了出来。 Yahoo may have rejected it due to a malformed or missing header. Yahoo可能由于标头格式错误或丢失而拒绝了它。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.