强制创建新的电子邮件线程
当编写基于某些事件发送电子邮件的应用程序时,我想强制执行每封电子邮件都启动一个新的“对话”的规则。
Gmail 等电子邮件系统喜欢将电子邮件分组为“对话”,这样消息 A 就被认为是对消息 B 的回复。他们使用很多方法来确定您要回复的消息,例如主题:标头或 In-Reply-To:标头。
然而,由于自动电子邮件有时会重复使用主题行(例如“服务器 foo.bar.com 上的监控失败”),因此邮件服务通常会假设给定的电子邮件实际上是对先前邮件的回复。具有相同主题行的邮件,即使两者不相关。这可能会导致混乱,并且客户可能会错过重要的通知。
是否有可能(如果可以,那么如何)在邮件标头中表明给定的电子邮件不是对任何其他电子邮件的回复,尽管主题行存在任何潜在的相似之处?
由于电子邮件主题本身对客户端可见,我希望避免像这样的愚蠢行为:“主题:$任务的自动提醒[“.md5sum(date())。”]“
When writing an application that sends email based on certain events, I would like to enforce the rule that each of these emails starts a new "conversation".
Email systems such as Gmail like group email messages into "conversations", such that messages A is presumed to be a reply to message B. There's lots of methods they use to determine what message you're replying to, such as the Subject: header or the In-Reply-To: header.
However, since automated emails tend to sometimes reuse subject lines (e.g. "Monitoring failure on server foo.bar.com"), often the mail service will assume that a given email is actually a reply to a previous message with the same subject line, even though the two are unrelated. This can lead to confusion and clients potentially missing an important notification.
Is it possible (and if so, then how) to signal in your mail headers that a given email is NOT a reply to any other, despite any potential similarities in the subject lines?
Since the email subject itself is visible to the client, I would prefer to avoid silliness like this: "Subject: Automated reminder for $task [".md5sum(date())."]"
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
确实没有一种方法可以为所有电子邮件系统执行此操作。即使您确实弄清楚了如何绕过 Gmail,那么 Mail.app、Thunderbird 和 Outlook 的线程对话模式又如何呢?当然,支持此类功能的每个邮件客户端都会以不同的方式确定消息对给定对话的成员资格。
话虽如此,大多数客户端似乎都使用发件人、回复和主题的组合。 Gmail Web 客户端使用内部线程标识符来更准确地跟踪从 Web 客户端发送的电子邮件。您是否考虑过从不同的电子邮件地址发送邮件?以 Gmail 为例,
[电子邮件受保护]
与[电子邮件受保护]
相同。为了邮件路由的目的,+
之后的任何内容都会被剥离并忽略,但我认为在计算线程成员身份时不会忽略它。不过,我不确定此寻址规则是否特定于 Gmail,或者是否是标准的一部分。There isn't really a way to do this for all email systems. Even if you do figure out how to get around it for Gmail, what about Mail.app's, Thunderbird's, and Outlook's threaded conversation modes? Certainly each mail client that supports such functionality determines messages' membership to a given conversation differently.
That being said, it appears that most clients use a combination of sender, reply-to, and subject. The Gmail web client uses internal thread identifiers to track emails sent from the web client more accurately. Have you thought about sending from different email addresses? With Gmail, for example,
[email protected]
is the same as[email protected]
. Anything after+
is stripped and ignored for the sake of mail routing, but I don't think it's ignored when computing thread membership. I'm not sure if this addressing rule is Gmail-specific or if it's part of the standard, though.大多数电子邮件客户端根据以下标题组织线程 InReplyTo、参考文献、线程索引(来自 Outlook)。因此,如果您没有在电子邮件中指定这些内容,我认为它不会被视为任何现有线程的一部分(除非打开了基于主题的基本线程)。
现在,GMail 还考虑了主题。所以我想如果您也想更改主题行。你必须尝试一些。
Most email clients organize threads based on the following headers InReplyTo, References, Thread-Index (from Outlook). So if you don't specify those in your email message I think it wont be considered as part of any existing thread (unless a basic Subject based threading is on).
Now, GMail also takes into account Subject. So I think if you'd want to change the subject line also. You'll have to experiment some.
尽管您可以以用户身份禁用 Gmail 中的对话线程,但无法告诉它不要对您发送给其他人的电子邮件进行线程处理。
为什么不直接将日期附加到末尾呢?这样您将获得更容易访问的信息,并且您不应该将一大堆旧消息作为线程的一部分拖拽起来。
Though you can disable conversation threading in Gmail as a user, there is no way to tell it not to thread an email you send to someone else.
Why not just append the date to the end? That way you will have a bit more easily-accessible information, and you shouldn't have a whole bunch of old messages dragged up as part of a thread.