通过 SMTP 发送带有保证 ID 的消息
美好的一天!
抱歉提出这么“明确”的问题,让我解释一下。在我的“程序”中,我通过(例如)gmail SMTP 服务器发送一些电子邮件。假设我发送的每封电子邮件的标头中都包含一些唯一的 ID(由我生成)。从 gmail 检索消息(例如,使用 python imaplib)后,我是否有机会再次获得该唯一 ID(在标头中)?
谢谢
good day!
sorry for so "clear" question, let me explain. In my "program", i'm sending some emails, through (for example) gmail SMTP server. Let's pretend that every email, which i've sent, contains some unique ID (generated by me) in header. Is there any chance, after retrieving that messages from gmail (for example, with python imaplib), i will get that unique ID (in header) again?
thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
一般来说,MTA 将保留您引入的任何邮件标头。 需要中继 MTA 来执行此操作:
通常,接收 MTA 还将添加与邮件接收、垃圾邮件检查、循环检测等相关的其他标头。所以,是的,无论您使用哪个目标 SMTP 服务器(GMail 或其他),您几乎肯定是安全的。
如果 ID 确实是唯一的,您可能需要考虑将它们用作 您的
Message-ID
标头值。为此目的使用Message-ID
的好处是,当用户回复您的消息时,他们通常会在其In-Reply 中包含该
和/或Message-ID
值-ToReferences
标头:In general, MTAs will preserve whatever message headers you introduce. Relaying MTAs are required to do so:
And in general the receiving MTA will also just add further headers related to message receipt, spam checking, loop detection, and the like. So yes, you're almost certainly going to be safe regardless of which destination SMTP server you use, GMail or otherwise.
If the IDs truly are unique, you may want to consider using them as part of your
Message-ID
header value. The benefit of usingMessage-ID
for this purpose is that when users reply to your message, they will generally include thatMessage-ID
value in theirIn-Reply-To
and/orReferences
header:我刚刚对此做了一些测试,看起来可行,而且实际上非常简单。
我使用 Mail.php 扩展来实现这一点(不过应该没关系)。我在发送消息之前添加了一个额外的标头(“Trevor”=>“我的测试”)。我在 Gmail 中收到了该邮件并执行了“显示原始内容”,它包含标题。
然后我拉下这条消息(也通过 PHP),标题包含我输入的自定义行。
I just did a little testing on this, and it looks possible and actually pretty easy.
I used the Mail.php extension to make this happen (shouldn't matter, though). I added an extra header before I sent the message ("Trevor" => "My Test"). I received the message in Gmail and did a "Show Original" and it contains the header.
I then pulled this message down (also via PHP) and the header contains the custom line I entered.