【问题标题】:How to stop mail goes spam folder? [duplicate]如何阻止邮件进入垃圾邮件文件夹? [复制]
【发布时间】:2015-04-06 11:02:00
【问题描述】:

当触发我的邮件功能时,该邮件会进入“垃圾邮件”文件夹而不是“收件箱”。你能找出问题所在吗?

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
}

【问题讨论】:

    标签: php email gmail phpmailer


    【解决方案1】:

    你可以验证的东西很少:)

    1. 拥有 HTML 和文本内容。
    2. 尝试添加小而优质的 HTML 正文,而不仅仅是 br。
    3. 确认您使用的 SMTP 服务器设置正确。通常,如果您使用付费 SMTP,这不是问题,但如果是您的构建,则可能会出现问题。
    4. SPF 记录通常是一个问题,好像它们丢失了任何邮件都可以/将被视为垃圾邮件。

    【讨论】:

      【解决方案2】:

      通常,如果电子邮件的“发件人:”标头值的域部分与实际发送电子邮件的域不匹配,则该电子邮件被标记为垃圾邮件。

      绕过此问题的最简单方法是使用与您的域匹配的“发件人:”,并对您在“发件人:”标题中设置的电子邮件使用“回复:”标题

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

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

      【讨论】:

        猜你喜欢
        • 2013-04-27
        • 1970-01-01
        • 1970-01-01
        • 2012-03-03
        • 2011-06-29
        • 2014-12-21
        • 2018-12-18
        • 1970-01-01
        相关资源
        最近更新 更多