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 as开发者_运维百科sume 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())."]"
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, some-email@gmail.com
is the same as some-email+1234@gmail.com
. 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.
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.
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.
精彩评论