[英]How to group e-mails in group conversation?
我正在编写一个处理电子邮件的应用程序,我需要能够区分哪些电子邮件属于一个群组对话,以便我可以将它们组合到一个线程中。
问题是主题可能会改变(RE:RE:RE:RE:FWD:RE:...),没有出现在CC中的新人可能会回复等等。
所以我想知道确定哪些电子邮件属于特定对话的最佳方法是什么?
请记住,同一个人(CC)可能会开始不同的对话,所以我不能只依赖参与者,如上所示,主题也是。 外部用户可能是启动连锁邮件的人,因此使用消息 ID 和各种标题可能也不是最好的方法。
有些用户会引用以前的email,有些用户不会,所以分析身体也不可靠。
大多数电子邮件消息都会有一个Message-ID
,如果它存在,您可以假设它是唯一的。 电子邮件客户端在In-Reply-To
header 的回复中包含此 header 的值。 对于间接关系,例如转发电子邮件(不是回复),使用 header References
。
例如:
From: Alice <alice@example.org>
Subject: How about the proposal?
Message-Id: <aa11@example.org>
From: Bob <bob@example.org>
Subject: Re: How about the proposal?
Message-Id: <bb22@example.org>
In-Reply-To: <aa11@example.org>
From: Charlie <charlie@example.net>
Subject: Re: How about the proposal?
Message-Id: <cc33@example.net>
In-Reply-To: <aa11@example.org>
From: Alice <alice@example.org>
Subject: Re: Re: How about the proposal?
Message-Id: <dd44@example.org>
In-Reply-To: <cc33@example.net>
From: Bob <bob@example.org>
Subject: Fwd: How about the proposal?
Message-Id: <ee55@example.org>
References: <aa11@example.org>
像许多电子邮件标题一样,这些是可选的,但您可能不会遇到缺少它们的邮件(假设使用的电子邮件客户端支持线程,如 Apple Mail 和 GMail。低质量的 ISP 网络邮件可能不会)。 您不必只做一件事——您可以使用基于主题/日期/正文/收件人/发件人等的启发式方法来增强此方法。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.