简体   繁体   English

检索 Gmail 收件箱中存在的相关邮件的算法

[英]Algorithm to retrieve associated mails present in Inbox of Gmail

I wanted to know the algorithm followed by Gmail to retrieve the associated mails.我想知道 Gmail 之后的算法来检索相关邮件。

Example: I'm considering two people, Tom and John.示例:我正在考虑两个人,汤姆和约翰。 Tom has started a conversation with John.汤姆开始与约翰交谈。

Note: these are some representation of mails sent by Tom and John注意:这些是汤姆和约翰发送的邮件的一些表示

  (J-mail-1) : John's first mail.
  (T-mail-1) : Tom's first mail.
  (T-mail-2) : Tom's second mail.
  (J-mail-2) : John's second mail.
  (J-mail-3) : John's third mail.
  • Tom: Send a mail from his mail to John.(T-mail-1)汤姆:从他的邮箱里给约翰发一封邮件。(T-mail-1)
  • John: Reply back to mail to Tom.(J-mail-1)约翰:回复给汤姆的邮件。(J-mail-1)
  • Tom: Again he sent in a same thread to Tom.(T-mail-2)汤姆:他再次在同一个线程中发送给汤姆。(T-mail-2)
  • John: This time John, give response to first mail sent by Tom(J-mail-2)约翰:这次约翰,回复汤姆发送的第一封邮件(J-mail-2)
  • John: Again John reply to second mail of tom.(J-mail-3)约翰:约翰再次回复汤姆的第二封邮件。(J-mail-3)

Now if we see in the inbox of Tom's Gmail, we can find the response for 1st mail of the John is get associated or mapped with first mail and last mail of Tom.现在,如果我们在 Tom 的 Gmail 的收件箱中看到,我们可以发现 John 的第一封邮件的响应与 Tom 的第一封邮件和最后一封邮件相关联或映射。

So, I wanted to know what algorithm in server side is done to perform above type of operation.所以,我想知道在服务器端做了什么算法来执行上述类型的操作。 How is this properly mapped.这是如何正确映射的。

Final Outcome of above scenario.(In Tom's Inbox)上述方案的最终结果。(在汤姆的收件箱中)

(T-mail-1) ::::(Associated/Mapped) ::::: (J-mail-1) and (J-mail-2)

(T-mail-2) :::: (Associated/Mapped) :::::  (J-mail-3)

Thanks谢谢

Not sure what exactly Google does, but...不知道谷歌到底做了什么,但是......

RFC 2822 (among many others) defines email. RFC 2822(以及许多其他)定义了 email。 Each email should have a message ID, passed in the Message-ID: header.每个 email都应该有一个消息 ID,在Message-ID: header。 When you reply to an email, the mail client should include an In-Reply-To: header with a value of the message id of the message you reply to ( section 3.6.4 ).当您回复 email 时,邮件客户端包含一个In-Reply-To: header,其值为您回复的消息的消息 ID(第 3.6.4 节)。 Now in the inbox, you look at each email, check if it has a In-Reply-To: header, and look for the email with that ID.现在在收件箱中,您查看每个 email,检查它是否有In-Reply-To: header,并查找具有该 ID 的 email。 That would be its parent.那将是它的父母。

Some retarded email customer support systems may throw away the In-reply-to: header.一些延迟的 email 客户支持系统可能会丢弃In-reply-to: header。 As a second best guess, you can look at the email's Subject: header and use a regular expression to see if two emails are probably from the same conversation: if they only differ in a "Re:" prefix, they may be in the same conversation.作为第二个最佳猜测,您可以查看电子邮件的Subject: header 并使用正则表达式查看两封电子邮件是否可能来自同一个对话:如果它们仅在“Re:”前缀上有所不同,它们可能在同一个对话。 Count the "Re:" prefixes and compare the time stamps to figure out the conversation order.计算“Re:”前缀并比较时间戳以找出对话顺序。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM