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

2022-01-23 00:00:00 email gmail php spam

我的网站使用 PHP 邮件功能向用户发送电子邮件.Hotmail 和 Gmail 用户不会收到它们,或者它们最终会进入垃圾邮件文件夹.这是被 Gmail 标记为垃圾邮件的邮件的标题.

My website sends emails to users using the PHP mail function. Hotmail and Gmail users don't receive them, or they end up in SPAM-folder. Here is the header of a message marked as SPAM by Gmail.

怎么办?

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.

背景是:用户看不到信封地址(在您的情况下为 admin@drt01.dco.fusa.be).它只是被邮件服务器用来返回错误邮件.从历史上看,因为它们与管理员比与用户更相关.然而,今天将信封地址设置为与用户地址相同的事实标准.垃圾邮件发送者并没有真正这样做,因为他们要么没有可能,要么不想在发送垃圾邮件时收到所有退回的错误邮件.或者他们不希望被利用木马蠕虫的用户意识到他们的恶行.

The background is: The envelope adress (in your case admin@drt01.dco.fusa.be) isn't really visible to the user. 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.

在 php/sendmail 这个函数被称为 f 参数.您可以在函数文档中阅读所有相关信息:http://php.net/manual/zh/function.mail.php

In php/sendmail this function is called the f parameter. You can read all about that in the function documentation: http://php.net/manual/en/function.mail.php

类如 phpmailer 或 libmail 自己做这件事,使用其中一个可能是最好的主意,因为它们已经过测试,设计精良,可以对开发中的变化做出反应!

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!

接下来您可以将反向 DNS 设置为与发件人地址相同的域.如果你这样做,你真的非常值得信赖,因为邮件可以匹配到服务器,从而匹配到 provbider/admin,并且很容易被垃圾邮件网络列入黑名单.因此,如果您使用正确设置的反向 dns 发送垃圾邮件,您将不会做太久.arpa rulse 中有一个内置指令,这样一个条目的设置需要一段时间,因此不能以某种方式进行动态和利用.

The next thing you could do is to set the reverse-dns to the same domain that the sender adress is. 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. 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.

然而,这是相当先进的,每个 ip 地址只能有一个反向 dns 条目.因此,您无法在共享托管环境中执行此操作.您还必须联系您的提供商进行设置,但您可以通过 Google 搜索所有这些内容.

This is however rather advanced and there can only be one reverse dns entry per ip adress. 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.

总结:

  • 更正你的信封地址,应该没问题
  • 如果可以,设置反向 dns 条目

PS:对于如何以及何时将邮件视为垃圾邮件并没有真正的规定,并且上述技巧仅被证明在实践中有效,但绝对不能保证.每个邮件提供商都可以做他想做的事......(雅虎是这些候选人之一,他们做自己的事情并在过去惹恼每个人)

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. 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)

祝你好运

相关文章