在 PHP 中发送邮件是否需要“X-Mailer: PHP/<phpversion>”标头?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14661844/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-25 07:44:25  来源:igfitidea点击:

Is the "X-Mailer: PHP/<phpversion>" header required to send a mail in PHP?

php

提问by Pherrymason

A lot of examples I found online about sending emails with php set the header

我在网上找到的很多关于用 php 发送电子邮件的例子都设置了标题

"X-Mailer: PHP/" . phpversion()

But I find disclosing I'm using php and its version a very bad security practice.

但是我发现披露我正在使用 php 及其版本是一种非常糟糕的安全做法。

Is this a required header?

这是必需的标题吗?

采纳答案by Sven

Let's look at what kind of header is generated.

我们来看看生成了什么样的header。

According to RFC 2076, section 3.4, the header "X-Mailer" is, together with several others, non-standard. Which basically means that any mail software can treat it like it wants to, especially adding them or ignoring them. Absence of such headers cannot be used against the sender.

根据RFC 2076 的3.4 节,标题“X-Mailer”与其他几个一起是非标准的。这基本上意味着任何邮件软件都可以随心所欲地对待它,尤其是添加或忽略它们。不能对发件人使用缺少此类标头。

I'm pretty sure the "X-" prefix indicates "non-standard header" in SMTP message format as well, just as it does in HTTP headers or mime types.

我很确定“X-”前缀在 SMTP 消息格式中也表示“非标准标头”,就像在 HTTP 标头或 mime 类型中一样。

回答by Evert

I have to hit the minimum character limit.

我必须达到最小字符限制。

NO :)

不 :)

回答by Nicolas Chevallier

Not required, but you must verify all the headers because some providers (hotmail, yahoo, orange in France) are increasingly stringent and mark it as spam legitimate emails more easily

不是必需的,但您必须验证所有标头,因为某些提供商(法国的 hotmail、yahoo、orange)越来越严格,并且更容易将其标记为垃圾邮件合法电子邮件