简体   繁体   English

我的phpmailer脚本进入了垃圾邮件

[英]My phpmailer script goes to spam

I know this question has already been asked but no answers help me though. 我知道已经问过这个问题,但是没有答案可以帮助我。

Here is my code i hope you can find something wrong. 这是我的代码,希望您能找到错误的地方。

   <?php
    require("phpMailer/class.phpmailer.php");
    require("phpMailer/class.smtp.php");

    $mail = new PHPMailer();

    $mail->IsSMTP();   
    $mail->SMTPAuth = true;     // turn on SMTP authentication         
    $mail->Host = 'smtp.example.com';
    $mail->Port = 587;  
    $mail->Username = "mailer@example.com";  // SMTP username
    $mail->Password = "validpassword"; // SMTP password

    $mail->From = "mailer@example.com";
    $mail->FromName = "Mailer";
    $mail->AddAddress("my.email@gmail.com");
    $mail->AddReplyTo("mailer@example.com", "Mailer");

    $mail->WordWrap = 50;                                 // set word wrap to 50 characters

    $mail->IsHTML(true);                                  // set email format to HTML

    $mail->Subject = "Here is the subject";
    $mail->Body    = "This is the HTML message body <b>in bold!</b>";
    $mail->AltBody = "This is the body in plain text for non-HTML mail clients";

    if(!$mail->Send())
    {
       echo "Message could not be sent. <p>";
       echo "Mailer Error: " . $mail->ErrorInfo;
       exit;
    }

    echo "Message has been sent";
    ?>

PS : Funny fact is that my mail doesn't go in spam with the mailer()... But i have to use Phpmailer. PS:一个有趣的事实是我的邮件没有与mailer()成为垃圾邮件...但是我必须使用Phpmailer。

Your mail is going to spam, ergo your mail is being sent, ergo there is (probably) nothing wrong with your script. 您的邮件将成为垃圾邮件,因此,您的邮件正在发送,因此,您的脚本没有(可能)没有问题。 There are many reasons why mail is delivered to spam. 邮件传递到垃圾邮件的原因有很多。 Most obviously, it might be spam. 最明显的可能垃圾邮件。 You should be checking the configuration of your mail configuration, specifically check for correct SPF and DKIM records. 您应该检查邮件配置的配置,特别是检查SPF和DKIM记录是否正确。 If you're using a third-party mailing service check that they haven't themselves been blacklisted. 如果您使用的是第三方邮件服务,请检查自己是否未被列入黑名单。 Check your return addresses make sense and are valid. 检查您的寄信人地址是否合理并且有效。 Trace the path from the headers and see where any warnings are added en route. 跟踪标题中的路径,并查看在途中添加任何警告的位置。 And finally, check your own spam filters. 最后,检查您自己的垃圾邮件过滤器。

To see if the mail server that you are sending these through has a glaring problem that would cause other mail servers to think it's a spammer, try sending a message from your script to check-auth@verifier.port25.com. 要查看通过它们发送的邮件服务器是否存在明显的问题,该问题会导致其他邮件服务器认为它是垃圾邮件发送者,请尝试将脚本中的消息发送到check-auth@verifier.port25.com。 This service will do a bunch of checks, and you'll get a report back with ton of information, such weather or not your mail server's DNS is setup correctly, whether your mail server's IP is on any black lists, if you have a problem with your SPF records, etc. 此服务将进行大量检查,如果有问题,无论您的邮件服务器的IP是否在任何黑名单上,您都将获得大量信息的报告,例如天气或邮件服务器的DNS是否正确设置与您的SPF记录等

   //servidor smtp
   $mail->Mailer = "smtp";
   //Muy importante para que llegue a hotmail y otros 
   $mail->Helo = "localhost";
   //Asignamos a Host el nombre de nuestro servidor smtp
   $mail->Host = "localhost";
   $mail->Port = 25;

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

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