如何阻止垃圾邮件文件夹


How to stop mail goes spam folder?

当触发我的邮件功能时,邮件会进入"垃圾邮件"文件夹,而不是"收件箱"。你能弄清楚出了什么问题吗?

function send_user_email($mail, $to_email,$password, $first_name)
{
$html = "Hi $first_name, <br /><br />";
$html = $html . "<p> You have been registered with the system. Please find your login details below. </p>";
$html = $html . "User Name - $to_email <br />";
$html = $html . "Password - $password <br /> <br />";
$html = $html . "Regards, <br />";
$html = $html . "Team";
$mail->IsSMTP(); // telling the class to use SMTP
$mail->Host = "smtpout.XXX.XXX.XXX"; // sets GMAIL as the SMTP server
//  $mail->Host= "stmp.gmail.com"; // SMTP server
$mail->SMTPAuth = true; // enable SMTP authentication
$mail->SMTPSecure = "ssl"; // sets the prefix to the servier
$mail->Port = XXX; // set the SMTP port for the GMAIL server
$mail->Username  = "mailid"; // GMAIL username
$mail->Password  = 'password';// GMAIL password
$mail->From = "mailid";
$mail->FromName = "name";
$mail->Subject = "User invitation email";
$mail->AltBody = ""; // optional, comment out and test
$mail->IsHTML(true);
$mail->Body = nl2br($html);
$mail->AddAddress($to_email);
$mail->Send(); // send message
}

您可以验证的几件事:)

  1. 拥有HTML和文本内容
  2. 尝试添加小但高质量的HTML正文,而不仅仅是br
  3. 请验证您使用的SMTP服务器是否设置正确。通常,如果你使用付费SMTP,这不是问题,但如果是你的构建,它可能会有问题
  4. SPF记录通常是,如果它们丢失了任何邮件,就会被视为垃圾邮件

通常,如果电子邮件的"From:"标头值的域部分与实际发送电子邮件的域不匹配,则将其标记为垃圾邮件。

绕过这一点的最简单方法是使用与您的域匹配的"发件人:",并使用您在"发件人:"标题中设置的电子邮件的"回复收件人:"标题

例如:如果你从mydomain.com发送邮件,而你的发件人电子邮件是me@hotmail.com,您应该将标题更改为:

From: me@mydomain.com
Reply-To: me@hotmail.com