问题
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.
回答1:
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.
来源:https://stackoverflow.com/questions/31460653/quote-original-message-in-a-reply-using-mailkit