TL;DR:从共享主机(例如 Unoeuro 或 One.com 的廉价域名)发送的邮件最终会成为垃圾邮件。怎么修?
我制作了一个邮件系统,它首先生成了一个 PDF 文件(使用FPDF),然后它使用 PHP 的 Swiftmailer 将 PDF 文件作为附件发送。这封电子邮件已发送给 130 人(作为“一张”发票)。但它进入了几乎每个人的垃圾邮件过滤器。我尝试调整 SwiftMailers 标头设置,但没有任何运气。甚至是我以前没有发送过的邮件(经过彻底测试)。这是我的初始设置:
function sendMailEt($toEmail, $toName, $invoiceNumber){
require_once('includes/lib/swift_required.php');
$transport = Swift_SmtpTransport::newInstance('mailout.one.com', 25)
->setUsername('EMAIL-ACCOUNT1@THE-DOMAIN.DK')
->setPassword('THE-PASSWORD')
;
$mailer = Swift_Mailer::newInstance($transport);
$message = Swift_Message::newInstance('FROM COMPANY')
->setSubject('Thanks for signing up - COMPANY')
->setFrom(array('EMAIL-ACCOUNT1@THE-DOMAIN.DK' => 'Company name'))
->setTo(array($toEmail => $toName))
->setBody('A brief body, that explains that this is an invoice and that it has to be paid within 5 days. (written in danish)')
->addPart('A brief body, that explains that this is an invoice and that it has to be paid within 5 days. (written in danish)', 'text/html')
->attach(Swift_Attachment::fromPath('/URL-TO-THE-PDF-FILE.pdf'))
;
$result = $mailer->send($message);
}
我还尝试使用 PHP 的本机功能发送电子邮件mail()
,然后简单地链接到发票 ( http://www.company-domain-name.dk/invoice/base64_encoded-name.pdf
)...同样的结果(垃圾邮件)。
我尝试自己编写整个标题。我已经阅读了大量关于标题应包含哪些内容的论坛,但他们都写了不同的东西。所以我尝试了一些不同的东西(我之前发送过的电子邮件和我没有发送过的电子邮件)......结果相同(垃圾邮件)。
然后我尝试在他们的标题中完全按照 MailChimps 的方式编写标题。这导致我这样做:
$headers = "Reply-To: Company name <UNUSED-EMAIL-ACCOUNT-FROM-DOMAIN@DOMAIN-NAME.DK>\r\n";
$headers .= "Return-Path: Company name <UNUSED-EMAIL-ACCOUNT-FROM-DOMAIN@DOMAIN-NAME.DK>\r\n";
$headers .= "From: Message from Company name <UNUSED-EMAIL-ACCOUNT-FROM-DOMAIN@DOMAIN-NAME.DK>\r\n";
$headers .= "MIME-Version: 1.0\r\n";
$headers .= "Sender: Message from Company name <UNUSED-EMAIL-ACCOUNT-FROM-DOMAIN@DOMAIN-NAME.DK>\r\n";
$headers .= "Content-type: text/plain; charset=\"utf-8\"; \r\n";
$headers .= "X-Mailer: PHP". phpversion() ."\r\n";
然后我这样发送邮件:
mail($toName . '<'.$toEmail.'>', utf8_decode('Faktura på depositumet'), utf8_decode($someMessage), $headers);
...相同的结果(垃圾邮件)。
网络空间是 One.com,所以我不能使用PHPmailer(因为必须安装,而且不能在 one.com 的服务器上完成)。而且我无法使用 One.com 定义 SPF。
我想要的只是能够发送不属于垃圾邮件的电子邮件。
以下是我的问题:
是因为我的标题已关闭,还是因为“更深”?
Gmail 垃圾邮件过滤器是禁止单个电子邮件帐户(例如
this@example.com
)还是禁止整个域(例如@example.com
)?- 可以以某种方式将列入黑名单的电子邮件列入白名单吗?
* 加法 1 *
好的......我现在尝试了很多事情:
- 我尝试像推荐的那样添加 LoneWolfPR 的返回路径,但没有帮助。
- 我联系了 One.com(托管公司),并与他们确认,无法设置 SPF 记录或 DKIM 记录。它仍然不是。
- 我考虑设置一个“取消订阅”链接,其中包含一个带有表单的网站链接,但我不相信这种方法。我的意思是 - 发票一直通过电子邮件发送。为什么你应该能够取消订阅发票?!由于这在我的脑海中毫无意义,所以我只尝试了大约 20 分钟(显然,没有结果)。
这是我当前的电子邮件标题(通过单击“查看原件”从 Gmail 获得):
Delivered-To: NEWLY-CREATED-GMAIL-ACCOUNT@gmail.com
Received: by 10.76.75.104 with SMTP id b8csp48728oaw;
Sat, 16 Mar 2013 17:32:56 -0700 (PDT)
X-Received: by 10.152.116.45 with SMTP id jt13mr7897860lab.0.1363480376067;
Sat, 16 Mar 2013 17:32:56 -0700 (PDT)
Return-Path: <XXX111@DOMAIN-NAME.dk>
Received: from mail-out2.b-one.net (mail-out2.one.com. [91.198.169.19])
by mx.google.com with ESMTP id p10si4637427lbb.120.2013.03.16.17.32.55;
Sat, 16 Mar 2013 17:32:55 -0700 (PDT)
Received-SPF: neutral (google.com: 91.198.169.19 is neither permitted nor denied by best guess record for domain of XXX111@DOMAIN-NAME.dk) client-ip=91.198.169.19;
Authentication-Results: mx.google.com;
spf=neutral (google.com: 91.198.169.19 is neither permitted nor denied by best guess record for domain of XXX111@DOMAIN-NAME.dk) smtp.mail=XXX111@DOMAIN-NAME.dk
Date: Sat, 16 Mar 2013 17:32:55 -0700 (PDT)
Message-Id: <51450f37.6a0b700a.6239.5dbcSMTPIN_ADDED_MISSING@mx.google.com>
Received: from localhost.localdomain (srv18.one.com [193.202.110.18])
by mail-out2.b-one.net (Postfix) with ESMTP id F3D0B10365
for <NEWLY-CREATED-GMAIL-ACCOUNT@gmail.com>; Sun, 17 Mar 2013 01:32:53 +0100 (CET)
Received: from 85.218.159.219 by www.DOMAIN-NAME.dk via URL_TO_THE_SCRIPT.php with HTTP; Sun, 17 Mar 2013 00:32:53 +0000
To: RECIEVERS_NAME <NEWLY-CREATED-GMAIL-ACCOUNT@gmail.com>
Subject: EMAIL-SUBJECT
X-PHP-Originating-Script: 87486:NAME-OF-THE-SCRIPT-THE-E-MAIL-WAS-SENT-FROM.php
Reply-To: COMPANY NAME <XXX111@DOMAIN-NAME.dk>
From: Besked fra COMPANY NAME <XXX111@DOMAIN-NAME.dk>
MIME-Version: 1.0
Sender: Besked fra COMPANY NAME <XXX111@DOMAIN-NAME.dk>
Content-type: text/plain; charset="utf-8";
X-Mailer: PHP5.3.21