在使用mailkit的回复中引用原始消息 [英] Quote original message in a reply using mailkit
本文介绍了在使用mailkit的回复中引用原始消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有什么办法在回复中引用原邮件
例如:
大家好,我没事。
在16/07/15发送来自:user@mail.com到:我
喜Jefh,你怎么样?
块引用>
块引用>
我知道我可以在一个新的消息附加的原始邮件,但我真的想为报价原始邮件。
解决方案有没有MimeKit API引用的消息,但它不是非常困难的事情。下面的代码片段是开始(可能要定制一个位)的好地方。
字符串QuoteMessageBody(的MimeMessage消息)
{
使用(VAR报价=新的StringWriter()){
quoted.WriteLine(关于{0},{1}中写道:message.Date.ToString(F ),message.From.ToString());使用(VAR读卡器=新StringReader(message.TextBody)){
串线
;
,而((行= reader.ReadLine())!= NULL){
quoted.Write(>中);
quoted.WriteLine(线);
}
}
返回quoted.ToString();
}
}
希望有所帮助。
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.
解决方案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.
这篇关于在使用mailkit的回复中引用原始消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文