8

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);
einUsername
  • 1,569
  • 2
  • 15
  • 26

1 Answers1

8

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.

Community
  • 1
  • 1
DanTheMan
  • 3,277
  • 2
  • 21
  • 40