Return-Path 标头的正确格式

发布于 2024-07-22 04:57:25 字数 954 浏览 2 评论 0原文

我的应用程序使用 sendmail 发送出站电子邮件。 我使用以下格式设置“发件人:”地址:

Fred Dibnah <[email protected]>

我还使用完全相同的格式设置 Reply-ToReturn-Path 标头。

这似乎在绝大多数情况下都有效,但我至少看到过一个失败的实例,即当上述字符串的名称部分包含句点(句号)时:

Fred Dibnah, Inc. <[email protected]>

这在 TMail< 的深处失败了/strong> 代码(我正在使用 Ruby),但这似乎是一件完全有效的事情。

我的问题是,我实际上应该仅使用电子邮件地址而不是上述名称 + 电子邮件格式来设置 Return-PathReply-To 标头吗? 例如,

[email protected]

谢谢。

My application uses sendmail to send outbound email. I set the 'From:' address using the following format:

Fred Dibnah <[email protected]>

I'm also setting the Reply-To and Return-Path headers using the exact same format.

This seems to work in the vast majority of cases but I have seen at least one instance in which this fails, namely when the name part of the above string contains a period (full stop):

Fred Dibnah, Inc. <[email protected]>

This fails deep inside the TMail code (I'm using Ruby) but it seems like a perfectly valid thing to do.

My question is, should I actually be setting the Return-Path and Reply-To headers using only the email address as opposed to the above Name + Email format? E.g.

[email protected]

Thanks.

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

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

发布评论

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

评论(1

居里长安 2024-07-29 04:57:25

在这种情况下,最好求助于 RFC。

阅读您的问题,似乎不应该设置Return-Path值。 最终目标 SMTP 服务器应该在将邮件传输到您的邮箱时设置此值 (http ://www.faqs.org/rfcs/rfc2821.html 从 4.4 开始)。

根据 http://www.faqs.org/rfcs/rfc2822.html 回复字段可以采用以下格式

  1. 本地部分“@”域 ([电子邮件受保护]
  2. 显示名称(例如 Fred Dibna)

我建议使用选项 1,因为它似乎是最基本的,并且您可能会遇到该格式的较少问题。 选择选项 1 时,您的回复字段应如下所示:

Reply-To: [email protected]

In a situation like this, it is best to turn to the RFCs.

Upon reading up on your question, it appears as if You shouldn't be setting the Return-Path value ever. The final destination SMTP server is supposed to be setting this value as it transitions the message to your mailbox (http://www.faqs.org/rfcs/rfc2821.html starting at 4.4).

According to http://www.faqs.org/rfcs/rfc2822.html the Reply-To field can have the following formats

  1. local-part "@" domain ([email protected] for example)
  2. display-name (Fred Dibna for example)

I would recommend using option 1 as it seems to be the most basic, and you will likely have less issues with that format. In choosing option 1, your Reply-To field should look like the following:

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