PHPMailer – 邮件直接发送垃圾邮件

每当我使用PHPMailer发送自动电子邮件时,它都会直接进入Gmail中的垃圾邮件文件夹.我自己试图找到解决方案,但我对电子邮件和电子邮件标题不太了解.

任何人都可以解释为什么会这样吗?

下面是PHP代码,后面是从接收器显示的标头.

谢谢!

$mail = new PHPMailer;
$mail->From = "chrisxenongroup@server.xenonacademy.org.uk";
$mail->FromName = 'Xenon Group Academy';
$mail->AddAddress($email);
$mail->Subject = "Your Xenon Group Academy login details";
$mail->IsHTML(true);
$mail->Body = "<html><body><h3>Welcome to the Xenon Group Academy</h3><p>The Academy is an online system that will allow you to access course materials, manage your assignments and network with other Xenon Group students.</p>
<p>To access your account, go to <a href='http://www.xenonacademy.org.uk'>www.xenonacademy.org.uk</a> and use the following details to login.</p><p><pre>E-mail:            $email</pre></p><p><pre>Password:       " . mysqli_real_escape_string($conn, $_POST['password']) . "</pre></p><br /><br /><p>Once you have logged in, we would recommend changing your password to something secure and easy to remember. You can also change your login e-mail address if you need to.</p><p>Welcome to the Academy, and good luck with your qualification!</p></body></html>";
$mail->Send();



Delivered-To: xxxxxxxxxx@gmail.com
Received: by 10.49.109.71 with SMTP id hq7csp68808qeb;
        Thu, 23 May 2013 07:27:28 -0700 (PDT)
X-Received: by 10.180.37.243 with SMTP id b19mr25275110wik.12.1369319247650;
        Thu, 23 May 2013 07:27:27 -0700 (PDT)
Return-Path: <chrisxenongroup@server.xenonacademy.org.uk>
Received: from server.xenonacademy.org.uk (vps69719724.123-vps.co.uk. [46.32.233.107])
        by mx.google.com with ESMTPS id n5si14506537wic.103.2013.05.23.07.27.26
        for <xxxxxxxxxx@gmail.com>
        (version=TLSv1 cipher=RC4-SHA bits=128/128);
        Thu, 23 May 2013 07:27:27 -0700 (PDT)
Received-SPF: neutral (google.com: 46.32.233.107 is neither permitted nor denied by best guess record for domain of chrisxenongroup@server.xenonacademy.org.uk) client-ip=46.32.233.107;
Authentication-Results: mx.google.com;
       spf=neutral (google.com: 46.32.233.107 is neither permitted nor denied by best guess record for domain of chrisxenongroup@server.xenonacademy.org.uk) smtp.mail=chrisxenongroup@server.xenonacademy.org.uk
Received: by server.xenonacademy.org.uk (Postfix, from userid 10000)
    id DFBAAE0288; Thu, 23 May 2013 15:27:24 +0100 (BST)
To: xxxxxxxxxx@gmail.com
Subject: Your Xenon Group Academy login details
X-PHP-Originating-Script: 10000:class.phpmailer.php
Date: Thu, 23 May 2013 15:27:24 +0100
From: Xenon Group Academy <chrisxenongroup@server.xenonacademy.org.uk>
Message-ID: <10c74f9a6380f353cb1bdfb4e7c22f52@www.xenonacademy.org.uk>
X-Priority: 3
X-Mailer: PHPMailer 5.2.6 (https://github.com/PHPMailer/PHPMailer/)
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
Content-Type: text/html; charset=iso-8859-1

<html><body><h3>Welcome to the Xenon Group Academy</h3><p>The Academy is an online system that will allow you to access course materials, manage your assignments and network with other Xenon Group students.</p>
<p>To access your account, go to <a href='http://www.xenonacademy.org.uk'>www.xenonacademy.org.uk</a> and use the following details to login.</p><p><pre>E-mail:            xxxxxxxxxx@gmail.com</pre></p><p><pre>Password:     xxxxxxxx</pre></p><br /><br /><p>Once you have logged in, we would recommend changing your password to something secure and easy to remember. You can also change your login e-mail address if you need to.</p><p>Welcome to the Academy, and good luck with your qualification!</p></body></html>

谢谢!

解决方法:

这听起来更像是邮件服务器和/或DNS服务器的配置问题.您的邮件服务器看起来不够“受信任”,因此您无法从GMail(和邮件客户端)获得足够的“积极”积分.我注意到你使用postfix作为你的邮件…你有没有正确配置它?

我建议你先配置postfix.例如,以下是如何在CentOS中执行此操作的指南:

http://wiki.centos.org/HowTos/postfix

其次,您应该将SPF记录添加到DNS服务器:

http://en.wikipedia.org/wiki/Sender_Policy_Framework

第三,为您的服务器提供反向查找条目会很好:

http://en.wikipedia.org/wiki/Reverse_DNS_lookup

您需要执行上述操作以及其他一些操作,以确保客户端不会将您的邮件标记为垃圾邮件,并且您不会被列入黑名单

这是一个很好的清单,可以避免被列入黑名单:

https://www.supportsages.com/prevent-your-mailip-from-getting-marked-as-spamblacklisted-a-few-tips/

上一篇:使用phpmailer发送邮件不要转到“已发送”IMAP文件夹


下一篇:GoDaddy Linux上的PHP共享尝试通过GMAIL SMTP发送