简体   繁体   English

php邮件功能:通过gmail和hotmail标记为垃圾邮件的合法邮件

[英]php mail function: legitimate mails marked as spam by gmail and hotmail

My website sends emails to users using the PHP mail function. 我的网站使用PHP邮件功能向用户发送电子邮件。 Hotmail and Gmail users don't receive them, or they end up in SPAM-folder. Hotmail和Gmail用户不会收到它们,或者它们最终会进入垃圾邮件文件夹。 Here is the header of a message marked as SPAM by Gmail. 以下是Gmail标记为垃圾邮件的邮件标题。

What to do? 该怎么办?

Delivered-To: koopter1982@gmail.com
Received: by 10.216.213.222 with SMTP id a72cs207473wep;
        Sat, 2 Oct 2010 04:26:47 -0700 (PDT)
Received: by 10.216.3.19 with SMTP id 19mr3099233weg.108.1286018806068;
        Sat, 02 Oct 2010 04:26:46 -0700 (PDT)
Return-Path: <admin@drt01.dco.fusa.be>
Received: from drt01.dco.fusa.be (drt01.dco.fusa.be [193.110.251.55])
        by mx.google.com with ESMTP id m29si2837219weq.203.2010.10.02.04.26.45;
        Sat, 02 Oct 2010 04:26:46 -0700 (PDT)
Received-SPF: pass (google.com: best guess record for domain of admin@drt01.dco.fusa.be designates 193.110.251.55 as permitted sender) client-ip=193.110.251.55;
Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of admin@drt01.dco.fusa.be designates 193.110.251.55 as permitted sender) smtp.mail=admin@drt01.dco.fusa.be
Received: from admin by drt01.dco.fusa.be with local (Exim 4.69)
    (envelope-from <admin@drt01.dco.fusa.be>)
    id 1P20En-000303-Lo
    for koopter1982@gmail.com; Sat, 02 Oct 2010 13:26:45 +0200
To: koopter1982@gmail.com
Subject: Koopte: zoekertje activeren
X-PHP-Script: www.koopte.be/confirmation.php for 213.118.179.121
From: Koopte <zoekertjes@koopte.be> 
Reply-To:<zoekertjes@koopte.be> 
Content-Type: text/html; charset=iso-8859-1
Message-Id: <E1P20En-000303-Lo@drt01.dco.fusa.be>
Sender:  <admin@drt01.dco.fusa.be>
Date: Sat, 02 Oct 2010 13:26:45 +0200

Your envelope adress doesnt match the from adress. 你的信封地址与地址不匹配。 This is the main reason why mails are regarded as spam. 这是邮件被视为垃圾邮件的主要原因。

The background is: The envelope adress (in your case admin@drt01.dco.fusa.be) isn't really visible to the user. 背景是:信封地址(在您的情况下为admin@drt01.dco.fusa.be)对用户不是真的可见。 Its just used by mailservers to return error mails. 它只是由邮件服务器用于返回错误邮件。 Historically because they are more relevant to the admin than to the user. 从历史上看,因为它们与管理员比与用户更相关。 However today its de-facto standard to set the envelope address to the same as the user address. 然而今天它的事实标准是将信封地址设置为与用户地址相同。 Spammers don't really do that because they either don't have the possibility to or they don't want to recieve all the backbouncing error mails when sending spam. 垃圾邮件发送者并不真的这样做,因为他们要么没有可能,要么他们不想在发送垃圾邮件时收到所有反向收发错误邮件。 Or they don't want the exploited users with the trojan worm be aware of their evil-doing. 或者他们不希望遭受特洛伊蠕虫攻击的用户意识到他们的邪恶行为。

In php/sendmail this function is called the f parameter. 在php / sendmail中,此函数称为f参数。 You can read all about that in the function documentation: http://php.net/manual/en/function.mail.php 您可以在函数文档中阅读所有相关内容: http//php.net/manual/en/function.mail.php

Classes like phpmailer or libmail do this their selves and its probably the best idea to use one of theese because they have been tested, are well designed and react to changes in their developement! 像phpmailer或libmail这样的类可以自己做这个,它可能是使用其中一个的最好的主意,因为它们已经过测试,设计得很好并且对它们的开发变化作出反应!

The next thing you could do is to set the reverse-dns to the same domain that the sender adress is. 您可以做的下一件事是将reverse-dns设置为发件人地址所在的域。 If you do this you are really, really trustworthy because the mail can be matched to a server and thus to a provbider/admin and could be easily blacklisted by spam networks. 如果您这样做,那么您真的非常值得信赖,因为邮件可以与服务器匹配,从而与发起者/管理员匹配,并且很容易被垃圾邮件网络列入黑名单。 So if you would spam with a correctly set up reverse dns you wouldnt do it long. 因此,如果你使用正确设置的反向dns垃圾邮件,你就不会这么做。 There is a built-in directive in arpa rulse that the set up of such an entry takes a while so it cant be made somehow danymically and exploited. 在arpa rulse中有一个内置的指令,这样一个条目的设置需要一段时间,所以它不能以某种方式在某种程度上被danymically和剥削。

This is however rather advanced and there can only be one reverse dns entry per ip adress. 然而,这是相当先进的,每个ip地址只能有一个反向dns条目。 So you can't do it on a shared hosting environment. 因此,您无法在共享托管环境中执行此操作。 You also have to contact your provider to set them up but you can google for all that stuff. 您还必须联系您的提供商进行设置,但您可以谷歌搜索所有这些内容。

Sum up: 总结:

  • correct your envelope adress, that should be fine 纠正你的信封地址,这应该没问题
  • if you can, set a reverse dns entry 如果可以,请设置反向dns条目

PS: there are not really rules how and when to regard a mail as spam and the teqniques above have only proven to work in praxis but there is absolutely no guarantee. PS:没有真正的规则如何以及何时将邮件视为垃圾邮件,而上述技术仅被证明可以在实践中使用,但绝对没有保证。 Every mail provider can do what he wants... (yahoo was one of theese candidates to do their very own thing and to annoy everybody with it in the past) 每个邮件提供商都可以做他想做的事情......(雅虎是做他们自己的事情并且过去惹恼所有人的候选人之一)

good luck 祝好运

Try using google apps and setting up the spf record, going to setting -> security and setting up the txt dkim key. 尝试使用谷歌应用程序并设置spf记录,转到设置 - >安全性和设置txt dkim键。 Then setup the mx records, etc. do all of this on a subdomain of your domain (eg, int.domain.com) and then use smtp to send the mail from phpmail after signing into the account in google, clicking the settings button on right, click settings, php/imap, and enabling both. 然后设置mx记录等,在域的子域(例如int.domain.com)上执行所有操作,然后使用smtp在登录Google帐户后从phpmail发送邮件,单击设置按钮右键单击设置,php / imap,然后启用两者。

This always works for me and they never get marked as spam because they come from google's servers and have a valid header, return path, sender, smtp, spf record, txt dkim record, mx records, etc. 这对我来说总是有用,它们永远不会被标记为垃圾邮件,因为它们来自谷歌的服务器,并且有一个有效的标题,返回路径,发送者,smtp,spf记录,txt dkim记录,mx记录等。

Try that out and let me know if it works :) 尝试一下,让我知道它是否有效:)

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

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