Sender,From和Return-Path之间有什么区别?

时间:2010-12-06 14:25:21

标签: email smtp

电子邮件发件人,发件人和回程路径值之间有什么区别?

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

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

3 个答案:

答案 0 :(得分:152)

因此,在提交邮件时通过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,以便任何投放报告转到它而不是发件人。

如果您正在这样做,表单提交以发送电子邮件,那么这可能与您设置标题的方式直接并行。

答案 1 :(得分:86)

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

http://tools.ietf.org/html/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.

答案 2 :(得分:17)

对此进行细微更新:发件人不应设置Return-Path:标头。传输中的消息没有Return-Path:标头。该标头由最终交付的MTA设置,通常设置为5321.From的值,除非本地系统需要某种奇怪的路由。

这是一种常见的误解,因为用户很少看到邮箱中没有Return-Path:标题的电子邮件。这是因为他们总是看到已发送的邮件,但MTA绝不会在传输中的邮件上看到Return-Path:标头。见http://tools.ietf.org/html/rfc5321#section-4.4