Php Mailer 问题 - 邮件被标记为垃圾邮件 -

发布于 2024-08-27 21:58:22 字数 464 浏览 5 评论 0原文

几天前,我升级了 Php Mailer,现在一些电子邮件提供商将我的邮件标记为垃圾邮件。这是我在标记消息的标题中看到的内容:

X-SpamTest-Info: {TO: header missing}

这是来自我的 php 文件。

$mail->From       = $sender;
$mail->FromName   = $sender_name;
$mail->Subject    = $subject;
$mail->Body       = $body;
$mail->AddAddress($recipient,$recipient_name);
$mail->AddReplyTo($replyto,"No-Reply");

不知道如何添加“to”标头,也不明白如何可能缺少“to”但电子邮件到达了正确的“to”地址...

A few days ago I upgraded Php Mailer and now some email providers my messages mark as spam. This is what I see in the headers of the marked messages:

X-SpamTest-Info: {TO: header missing}

This is from my php file.

$mail->From       = $sender;
$mail->FromName   = $sender_name;
$mail->Subject    = $subject;
$mail->Body       = $body;
$mail->AddAddress($recipient,$recipient_name);
$mail->AddReplyTo($replyto,"No-Reply");

Dont know how to add "to" header and can't understand how it's possible that "to" is missing but email arrives to the correct "to" address...

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

诗酒趁年少 2024-09-03 21:58:22

发送没有“收件人:”标头的邮件很容易,因为这里实际上发生了两件事。 “To:”标头实际上仅供人类查看 - 实际的交付是由所谓的“信封”控制的。当您在普通邮件程序中发送邮件时,它会启动 SMTP 转换,其中会获取“收件人”标头、“抄送”标头和“密件抄送”中列出的地址,去掉密件抄送标头,然后显示为SMTP 接收者“RCPT TO:地址1,地址2,...”并且 SMTP 接收者无需查看标头就知道将其发送给谁。它只查看标头来进行垃圾邮件检查,因为缺少“To”标头的邮件通常表明是垃圾邮件。

如果没有这样的信封,邮件传输代理可以访问,但最终用户及其邮件用户代理不能访问,则无法使用密件抄送。

我不知道 PHP Mailer 的语法,但它支持“$mail->To”设置吗?

It's easy for mail to be sent without a "To:" header, because there are actually two things going on here. The "To:" header is really only there for humans to look at - the actual delivery is controlled by what is called the "envelope". When you send your message in a normal mailer, it initiates an SMTP conversion where it takes the addresses listed in the "To" header, the "CC" header, and the "BCC", strips off the BCC header, and it says to the SMTP receiver "RCPT TO: address1, address2, ..." and the SMTP receiver knows who to send it to without looking at the headers. It only looks at the headers to do spam checking, because mail that is missing To headers often indicates spam.

If there wasn't an envelope like that that was accessible to the mail transfer agents but not the end users and their mail user agents, it wouldn't be possible to use BCC.

I don't know the syntax of PHP Mailer, but does it support a "$mail->To" setting?

萝莉病 2024-09-03 21:58:22

之前的回答中的一些要点:

  • 最重要的是: 发件人地址(“发件人”)是否属于您发送电子邮件的服务器上运行的域?如果没有,那就这样吧。切勿使用 [电子邮件受保护] 等发件人地址。如果您需要回复才能到达其他地址,请使用回复

  • 您的服务器是否在黑名单中(例如在 spamhaus.org 上检查 IP)?当您使用共享主机且邻居行为不当时,就有可能出现这种情况。

  • 邮件是否被垃圾邮件过滤器过滤?使用具有垃圾邮件文件夹的免费邮件程序开设一个帐户并找出答案。另外,尝试将邮件发送到根本没有任何垃圾邮件过滤的地址。

  • 是否可能需要 mail() 的第五个参数“-f”来添加发件人地址? (参见PHP手册中的mail()命令)

  • 如果您有权访问日志文件,当然请检查这些文件。

  • 您是否检查“发件人:”地址以查找可能的退回邮件(“退回发件人”)?您还可以设置单独的“errors-to”地址。

A few bullet points from a previous answer:

  • Most important: Does the sender address ("From") belong to a domain that runs on the server you send the E-Mail from? If not, make it so. Never use sender addresses like [email protected]. User reply-to if you need replies to arrive at a different address.

  • Is your server on a blacklist (e.g. check IP on spamhaus.org)? This is a possibility when you're on shared hosting when neighbours behave badly.

  • Are mails filtered by a spam filter? Open an account with a freemailer that has a spam folder and find out. Also, try sending mail to an address without any spam filtering at all.

  • Do you possibly need the fifth parameter "-f" of mail() to add a sender address? (See mail() command in the PHP manual)

  • If you have access to log files, check those, of course.

  • Do you check the "from:" address for possible bounce mails ("Returned to sender")? You can also set up a separate "errors-to" address.
橘和柠 2024-09-03 21:58:22

不知道如何添加“to”标题和
不明白怎么可能
缺少“to”,但电子邮件已到达
到正确的“收件人”地址...

这一行负责

$mail->AddAddress($recipient,$recipient_name);

它实际上为电子邮件创建“收件人”标头。

Dont know how to add "to" header and
can't understand how it's possible
that "to" is missing but email arrives
to the correct "to" address...

This line takes care of that

$mail->AddAddress($recipient,$recipient_name);

It actually creates the TO header for the email.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文