发件人、发件人和返回路径有什么区别?

电子邮件发件人、发件人和返回路径值之间的区别是什么?

示例 : 我有一个联系表单,用户可以在其中输入他们的电子邮件,这将被分配给发件人,从或返回路径?

我对 StackOverflow 进行了快速搜索,没有找到任何有用的东西。

126860 次浏览

因此,在提交邮件时,通过 SMTP,SMTP 信封(发件人、收件人等)与邮件的实际数据不同。

Sender标头用于在消息中标识提交它的人。这通常与消息来源的 From头相同。但是,在邮件代理代表其他人发送消息的某些情况下,它可能会有所不同。

Return-Path标头用于向收件人(或接收 MTA)指示将在何处发送未交付收据。

例如,以允许用户从网页发送邮件的服务器为例。因此,sender@yourcompany.com键入消息并提交它。然后,服务器将消息发送给其收件人,From设置为 sender@yourcompany.com。实际的 SMTP 提交使用不同的凭据,类似于 mailagent@mywebmail.com。因此,sender报头被设置为 mailagent@mywebmail.com,以表明 From报头没有指示实际提交消息的用户。

在这种情况下,如果无法发送消息,那么最好由代理接收未送达报告,因此 Return-Path也将设置为 mailagent@mywebmail.com,这样任何送达报告都会发送给它,而不是发送者。

如果您正在这样做,一个发送电子邮件的表单提交,那么这可能与您设置标题的方式有直接的相似之处。

定义此规范的官方 RFC 可以在这里找到:

Https://www.rfc-editor.org/rfc/rfc4021#section-2.1.2 (请参阅第2.1.2段及以下内容)

2.1.2标题栏: 来自

Description:
Mailbox of message author
[...]
Related information:
Specifies the author(s) of the message; that is, the mailbox(es)
of the person(s) or system(s) responsible for the writing of the
message. Defined as standard by RFC 822.

2.1.3标题字段: 发件人

Description:
Mailbox of message sender
[...]
Related information:
Specifies the mailbox of the agent responsible for the actual
transmission of the message.  Defined as standard by RFC 822.

2.1.22头部字段: 返回路径

Description:
Message return path
[...]
Related information:
Return path for message response diagnostics. See also RFC 2821
[17]. Defined as standard by RFC 822.

对此有一个小小的更新: 发件人永远不应该设置 Return-Path:标头。传输中的消息没有 Return-Path:头这种东西。这个报头由进行最终传递的 MTA 设置,并且通常设置为 5321.From的值,除非本地系统需要某种奇怪的路由。

这是一个常见的误解,因为用户很少看到邮箱中没有 Return-Path:标题的电子邮件。这是因为他们总是看到已传递的消息,但是 MTA 永远不应该在传输中的消息上看到 Return-Path:标头。见 https://www.rfc-editor.org/rfc/rfc5321#section-4.4