3

There is any way to quote the original message in a reply?

e.g.:

Hi, I'm fine.

Sent at 16/07/15 from: user@mail.com to: Me

Hei Jefh, how are you?

I know that I can 'attach' the original message in a new message, but I really want to quote the original message.

Community
  • 1
  • 1
Jéf Bueno
  • 425
  • 1
  • 5
  • 23

1 Answers1

3

There's no MimeKit API to quote a message, but it's not terribly difficult to do. The following code snippet is a good place to start (you may want to customize it a bit).

string QuoteMessageBody (MimeMessage message)
{
    using (var quoted = new StringWriter ()) {
        quoted.WriteLine ("On {0}, {1} wrote:", message.Date.ToString ("f"), message.From.ToString ());
        using (var reader = new StringReader (message.TextBody)) {
            string line;

            while ((line = reader.ReadLine ()) != null) {
                quoted.Write ("> ");
                quoted.WriteLine (line);
            }
        }

        return quoted.ToString ();
    }
}

Hope that helps.

jstedfast
  • 35,744
  • 5
  • 97
  • 110