【问题标题】:Warning on my messages from Gmail when sending email with PHPMailer使用 PHPMailer 发送电子邮件时,我的 Gmail 邮件警告
【发布时间】:2019-12-20 20:24:44
【问题描述】:

我需要有关使用 phpmailer 发送邮件的疑难解答方面的帮助。 我尝试使用 PHPmailer v6 发送邮件,一切正常,但是当我在 gmail 上收到消息时,我收到 RED MARK 警告消息:

This message appears dangerous
This message may contain unsafe content as many people have identified similar messages as phishing scams. So avoid clicking on links, downloading attachments, or responding with any personal information.

我真的不知道这条消息的原因,这是我在脚本中使用的代码:

$link ="<a href='".$setting['site_url']."?v=".$rand."'>".$setting['site_url']."?v=".$rand."</a>";
$mes='Hello,<br><br> Thank you for registering at '.$setting['faucet_name'].'. However, before you getting running on the site, you\'ve to confirm your email address.<br> Click here:  <b>'.$link.'</b><br> to confirm your account, or copy the link below directly to confirm your email address.<br><br> Regards,<br> '.$setting['faucet_name'].'<br><br><small>If you didn\'t apply for an account, please ignore this email and you won\'t be bugged again.</small>';

    $from='no-reply@'.$_SERVER['HTTP_HOST'];
    $mail = new PHPMailer();

    //Recipients
    $mail->setFrom($from, $setting['faucet_name']);
    $mail->addAddress($email, $username);                 
    // Content
    $mail->isHTML(true);                                 
    $mail->Subject = 'Confirm your account at '.$setting['faucet_name'];
    $mail->Body    = $mes;
    $mail->AltBody = 'please use HTML viewer to see the message';

    if($mail->send()){
    $stmt= $db->prepare("INSERT INTO verify_user(username,email,password,ref,verify_key,created)VALUES(?,?,?,?,?,?) ");
    $stmt->bind_param("sssssi",$username,$email,$password,$ref,$rand,$time);
    $stmt->execute();
    echo json_encode(array('success' =>'Message sent!'));
} else {
    echo json_encode(array('success' => "Message could not be sent."));
}

【问题讨论】:

  • 在gmail上查看收到的邮件的标题;它通常会告诉您为什么一条消息会导致问题。将它们添加到您的问题中,我们可以帮助诊断。
  • 这是来自 gmail 的帮助中心:“此邮件可能是骗局”警告您会在任何看起来像骗局但来自 Gmail 联系人列表中的地址的电子邮件上方看到此警告.
  • 是的,你已经说过了。我们需要查看标题的内容,因为它可能会告诉我们为什么他们会这样认为。

标签: email phpmailer sendmail


【解决方案1】:

虽然我不确定,但我想说问题不在您的代码中。

这很可能来自邮件本身的内容,正如 Gmail 所说的那样。它的算法根据一些标准估计您的电子邮件类似于通常由网络钓鱼者发送的许多电子邮件。因此,它会在您的收件箱中警告您这封邮件。

【讨论】:

  • 当我添加邮件链接时出现这种争吵,我也尝试了很多方法来更改邮件内容,但总是得到这个警告,我在分享问题之前搜索了很多,我觉得setFrom() 字段中的问题可能该字段不正确,使 gmail 过滤器怀疑该电子邮件,您对 setFrom() 字段有任何想法
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2014-10-19
  • 1970-01-01
  • 2017-05-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多