Is it possible to capture the “Message-ID” of an email message sent with SmtpClient?

时光毁灭记忆、已成空白 提交于 2019-12-03 07:50:54

The standard solution to your problem is VERP. Read Bernstein's original article to find out why Message-Id et al. are not reliable. http://cr.yp.to/proto/verp.txt

You can add your own message id before send the email. I use the next code:

Guid id = Guid.NewGuid(); //Save the id in your database 
mensajeEmail.Headers.Add("Message-Id", String.Format("<{0}@{1}>",id.ToString(),"mail.example.com"));

Note: For download messages I use OpenPop.Net, I check the message.Headers.InReplyTo property, and there is the message id sended.

user3772678

I'm Using MailKit library for .Net and SMTP Client.

I tried another solution to get the ID of the message sent with SMTP Client, to trace any replied messages.

Before you send your message add a hidden ID property to the message headers,

Now continue and send your message, Wait about 10 Seconds, Then you will use the IMAP Client to get your Sent folder and for each message in your folder, loop over the message headers and check if anyone of them is ==messageIdentity, now you catch your sent message successfully and get any information about it you wand like ID etc...

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