+1 vote

How can I link an email sent by SMTP with the response that comes to IMAP without the ID message?

by

1 Answer

0 votes

1.
First of all: all email messages are required to have a Message-ID header (IMail.MessageID) set.

If a message has no Message-ID header it's not a valid email and means
that the sending client is broken.

2.
All replies should include an In-Reply-To header (IMail.InReplyTo) and
a References header (IMail.References) filled with the original message's Message-ID.

In-Reply-To contains a single message id while References includes all ids in this thread.

Majority of email clients/servers do use the In-Reply-To and Reference headers.

3.
Another way is to include a certain reference number such as "[ref:XXXXXXXXX:ref]" inside the subject and/or email body and check for that.

Downside is, clients/agents (or even people) could remove it.

In most cases I'd suggest using both techniques.

by (300k points)
...