Return-Path 标头的正确格式
我的应用程序使用 sendmail 发送出站电子邮件。 我使用以下格式设置“发件人:”地址:
Fred Dibnah <[email protected]>
我还使用完全相同的格式设置 Reply-To 和 Return-Path 标头。
这似乎在绝大多数情况下都有效,但我至少看到过一个失败的实例,即当上述字符串的名称部分包含句点(句号)时:
Fred Dibnah, Inc. <[email protected]>
这在 TMail< 的深处失败了/strong> 代码(我正在使用 Ruby),但这似乎是一件完全有效的事情。
我的问题是,我实际上应该仅使用电子邮件地址而不是上述名称 + 电子邮件格式来设置 Return-Path 和 Reply-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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在这种情况下,最好求助于 RFC。
阅读您的问题,似乎您不应该设置Return-Path值。 最终目标 SMTP 服务器应该在将邮件传输到您的邮箱时设置此值 (http ://www.faqs.org/rfcs/rfc2821.html 从 4.4 开始)。
根据 http://www.faqs.org/rfcs/rfc2822.html 回复字段可以采用以下格式
我建议使用选项 1,因为它似乎是最基本的,并且您可能会遇到该格式的较少问题。 选择选项 1 时,您的回复字段应如下所示:
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
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: