c# - Send a mail as a reply using SmtpClient -


scenario : need send mail reply mail asp.net c# program. managed mail sent client, sends new mail.

code :

var smtp = _genrepository.getdata("select * location id='" + mail.locationid + "'").firstordefault(); smtpclient c = new smtpclient(smtp.smtp_host, smtp.smtp_port); mailaddress add = new mailaddress(mail.from); mailmessage msg = new mailmessage(); msg.to.add(add); msg.from = new mailaddress(smtp.email); msg.isbodyhtml = true; msg.subject = mail.subject; msg.body = mail.body; c.credentials = new system.net.networkcredential(smtp.email, smtp.emailpassword); c.enablessl = true; c.send(msg); 

i have sender's email messageid. need know how send mail reply.

if add following headers, mail client consider mail 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 not find 'official' reference smtp headers, following gives details:

the presence of in-reply-to , references headers indicate message reply previous message.

the references header makes "threaded mail reading" , per-discussion archival possible.

also, mail clients wants exact same subject well. please see related so post

in outlook, if the mail subject same , "conversation view" enabled folder, irrespective of above headers, group mails same subject together.

you can send reply using client manually , compare message headers original mail see how client adding message headers.


Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -