3

每当我使用 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>

谢谢!

4

3 回答 3

6

这听起来更像是您的邮件服务器和/或 DNS 服务器的配置问题。您的邮件服务器似乎不够“受信任”,因此您没有从 GMail(和邮件客户端)获得足够的“正面”积分。我注意到您使用 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/

于 2013-05-23T15:13:01.617 回答
0

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

于 2013-05-23T15:10:52.863 回答
-1

这是因为 html 正文文本标题。将简单的文本与一些标签(如强下划线等)一起尝试。

于 2015-10-28T19:42:36.227 回答