Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

gmail Conversation via smtp

Tags:

c#

smtp

gmail

how can i send an email as a part of a gmail-conversation via smtp? Taking the same subject doesnt work...

tell me if you need more infos... thanks in advance!

        MailMessage mail = new MailMessage();
        SmtpClient SmtpServer = new SmtpClient("smtp.gmail.com");

        mail.From = new MailAddress("@googlemail.com");
        mail.To.Add("@.com");
        mail.Subject = "(Somee.com notification) New order confirmation";
        mail.Body = "(Somee.com notification) New order confirmation";

        SmtpServer.Port = 587;
        SmtpServer.Credentials = new System.Net.NetworkCredential("", "");
        SmtpServer.EnableSsl = true;

        SmtpServer.Send(mail);
like image 939
einUsername Avatar asked Sep 25 '11 11:09

einUsername


1 Answers

You'll need to use the following:

mail.Headers.Add("In-Reply-To", <messageid>);

The message id you should be able to get from the previous email's headers. Just look for "Message-Id".

This answer gives a few more headers you may want to add to try help threading in other clients. It seems maybe gmail is now using these, too.

like image 93
DanTheMan Avatar answered Oct 14 '22 15:10

DanTheMan