Question:
Is there a way to insert an email id or tag in an email so that I can identify the email when I get the reply?
I am sending appointment reminder emails to customers from a VB.net application and want to be able to link the reply to the original email recipient, so I can update the database with their reply.
Answer:
The best option I can think of is to use the Message-ID header field. Normally, when you send
an email, the Chilkat mailman will auto-generate that header field. If the same email object is used for multiple sends, each time the email is sent a new Message-ID header field is auto-generated and used. (Some SMTP servers will assume an email is a duplicate and drop it when identical Message-ID’s are seen.) You can turn off auto-generation by setting the mailman.AutoGenMessageId property = false. In addition, you can manually add your own message-id by calling email.AddHeaderField("Message-ID","your-generated-ID").
It’s possible that the Message-ID may be present in the reply email in a "in-reply-to" header field, although it’s not always the case. I did some examining of my own mailbox and looked at various mail replies. Some contained "in-reply-to" header fields whereas others didn’t. You’ll have to experiment to see what information is available in a reply from a given mail server.
Other header fields to check for in the reply are "References" and "Original-Message-ID" — but only some mail servers add these headers.
(The References header field may be found in a reply email and specifies the message IDs of the emails in the thread. (Should be added to with each subsequent reply by appending the Message-ID of the message to which the reply is being made.) If there are more than 12, the first one and then the final 11 are copied, before adding the message ID of the incoming message.)