PHPMailer - 邮件直接发送到垃圾邮件 [英] PHPMailer - mails going straight to spam
问题描述
每当我使用PHPMailer发送自动电子邮件时,它都会直接进入Gmail的垃圾邮件文件夹。我已经尝试找到一个解决方案,但我不了解电子邮件和电子邮件头。
任何人都可以解释为什么会发生这种情况? / p>
PHP代码在下面,其后是从接收者显示的标题。
谢谢!
$ mail = new PHPMailer;
$ mail-> From =chrisxenongroup@server.xenonacademy.org.uk;
$ mail-> FromName ='氙气组学院';
$ mail-> AddAddress($ email);
$ mail-> Subject =您的Xenon Group Academy登录详细信息;
$ mail-> IsHTML(true);
$ mail-> Body =< html>< body>< h3>欢迎来到Xenon Group Academy< / h3>< p>学院是一个在线系统,将允许您访问课程材料,管理您的任务和与其他Xenon Group学生的网络。< / p>
< p>要访问您的帐户,请转到< a href ='http://www.xenonacademy.org。 uk'> www.xenonacademy.org.uk< / a>,并使用以下详细信息登录。< / p>< p>< pre>电子邮件:$ email< / pre>< / p> ;< p>< pre>密码:。 mysqli_real_escape_string($ conn,$ _POST ['password'])。 < / pre>< / p>< br />< br />< p>一旦您登录,我们建议您将密码更改为安全且容易记住的密码,您也可以如果需要,请更改您的登录电子邮件地址。< / p>< p>欢迎来到学院,祝您有资格!< / p>< / body>< / html>;
$ mail-> Send();
交付到:xxxxxxxxxx@gmail.com
收到:由10.49.109.71与SMTP id hq7csp68808qeb;
星期四,2013年5月23日07:27:28 -0700(PDT)
X收到:由10.180.37.243与SMTP id b19mr25275110wik.12.1369319247650;
星期四,2013年5月23日07:27:27 -0700(PDT)
返回路径:< chrisxenongroup@server.xenonacademy.org.uk>
收到:从server.xenonacademy.org.uk(vps69719724.123-vps.co.uk。[46.32.233.107])
由mx.google.com与ESMTPS id n5si14506537wic.103.2013.05.23。 07.27.26
为< xxxxxxxxxx@gmail.com>
(version = TLSv1 cipher = RC4-SHA bits = 128/128);
星期四,2013年5月23日07:27:27 -0700(PDT)
收到的SPF:中立(google.com:46.32.233.107既不被允许也不被拒绝,由chrisxenongroup的域名的最佳猜测记录@ server.xenonacademy.org.uk)client-ip = 46.32.233.107;
验证结果:mx.google.com;
spf = neutral(google.com:46.32.233.107不允许或拒绝chrisxenongroup@server.xenonacademy.org.uk域名的最佳猜测记录)smtp.mail=chrisxenonggroup@server.xenonacademy.org.uk
收到:by server.xenonacademy.org.uk(Postfix,from userid 10000)
id DFBAAE0288;星期四,2013年5月23日15:27:24 +0100(BST)
至:xxxxxxxxxx@gmail.com
主题:您的氙群学院登录详细信息
X-PHP起始脚本: 10000:class.phpmailer.php
日期:2013年5月23日,星期五15:27:24 +0100
来自:氙气学院< chrisxenongroup@server.xenonacademy.org.uk>
Message-ID:< 10c74f9a6380f353cb1bdfb4e7c22f52@www.xenonacademy.org.uk>
X优先级:3
X-Mailer:PHPMailer 5.2.6(https://github.com/PHPMailer/PHPMailer/)
MIME版本:1.0
Content-转移编码:8bit
内容类型:text / html; charset = iso-8859-1
< html>< body>< h3>欢迎来到Xenon Group Academy< / h3>< p>学院是一个在线系统,您可以访问课程资料,管理您的作业和与其他Xenon Group学生的网络。< / p>
< p>要访问您的帐户,请转到< a href ='http://www.xenonacademy.org.uk'> www.xenonacademy.org.uk< / a>并且使用以下详细信息登录。< / p>< p>< pre>电子邮件:xxxxxxxxxx@gmail.com< / pre>< / p>< p>< pre>密码:xxxxxxxx< ; / pre>< / p>< br />< br />< p>一旦您登录,我们建议您将密码更改为安全且容易记住的密码。您还可以更改您的登录电子邮件地址(如果需要)。< / p>< p>欢迎来到学院,祝您有资格!< / p>< / body>< / html> ;
谢谢!
这听起来更像是邮件服务器和/或DNS服务器的配置问题。您的邮件服务器似乎并不信任,所以您没有从GMail(和邮件客户端)获得足够的积极积分。我注意到你使用postfix作为你的邮件程序...你是否配置正确?
我建议你先配置postfix。例如,以下是CentOS中如何做的指南:
http://wiki.centos.org/HowTos/postfix
其次,您应该向您的DNS服务器添加一个SPF记录:
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-提示/
Whenever I send an automated e-mail using PHPMailer, it goes straight into the spam folder in Gmail. I have tried finding a solution to this myself but I don't know enough about e-mails and e-mail headers.
Can anyone explain why this is happening?
PHP Code is below, followed by the headers that show up from the receiver.
Thanks!
$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>
Thanks!
This does sound more like a configuration issue with your mail server and/or your DNS server. Your mail server does not appear to be "trusted" enough, so you don't get enough "positive" points from GMail (and mail clients). I notice that you're using postfix as your mailer... Have you configured it properly?
I would suggest you configure postfix first. For example, here's a guide on how to do it in CentOS:
http://wiki.centos.org/HowTos/postfix
Second, you should add an SPF record to your DNS server:
http://en.wikipedia.org/wiki/Sender_Policy_Framework
Third, it would be good to have a reverse lookup entry for your server:
http://en.wikipedia.org/wiki/Reverse_DNS_lookup
You will need to do the above and some more to make sure that clients don't flag your mail as spam, and you don't get blacklisted
Here's a good list of things to do to avoid getting blacklisted:
https://www.supportsages.com/prevent-your-mailip-from-getting-marked-as-spamblacklisted-a-few-tips/
这篇关于PHPMailer - 邮件直接发送到垃圾邮件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!