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

时间:2013-05-23 14:55:02

标签: php email 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>

谢谢!

3 个答案:

答案 0 :(得分:6)

这听起来更像是邮件服务器和/或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/

答案 1 :(得分:0)

我经常使用PHP Mailer,并且在发送垃圾邮件时没有遇到任何问题(但是!)。我想知道它是否与您的“来自”电子邮件地址有关,因为它不是传统的abc@xyz.com

答案 2 :(得分:-1)

这是因为html正文文本标题。将简单文本放在一些标签上,如强下划线等,然后尝试。