Send a mail as a reply using SmtpClient

帅比萌擦擦* 提交于 2019-11-29 16:49:45

If you add following headers, the mail client would consider the mail as a reply.

In-Reply-To

References

        MailMessage mailMessage = new MailMessage();
        mailMessage.Headers.Add("In-Reply-To", "<Message-ID Value>");
        mailMessage.Headers.Add("References", "<Message-ID Value>");

I could not find any 'official' reference for the SMTP headers, but the following gives some details:

The presence of In-Reply-To and References headers indicate that the message is a reply to a previous message.

The References header makes "threaded mail reading" and per-discussion archival possible.

Also, some mail clients wants the exact same subject as well. Please see this related SO post

In outlook, if the the mail subject is same and "conversation view" is enabled for the folder, then irrespective of the above headers, it would group all mails with the same subject together.

You can send a reply using your client manually and compare the message headers with the original mail to see how your client is adding the message headers.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!