This commit is contained in:
2019-07-05 14:23:20 +00:00
parent b7accbacf1
commit 021199a2f4
3 changed files with 172 additions and 151 deletions

View File

@@ -328,45 +328,48 @@ namespace rockfishCore.Util
quoted.WriteLine("On {0}, {1} wrote:", message.Date.ToString("f"), name);
//TODO: get text message just like in reader here for html only message
//sometimes body text is empty.
/*
var theBody = m.GetTextBody(MimeKit.Text.TextFormat.Plain);
//Try to get the original message text and format it as > quoted
var theBody = message.GetTextBody(MimeKit.Text.TextFormat.Plain);
if (theBody == null)
{
//might be an html email, try to get the text anyway
var ht = m.HtmlBody;
//No text body so go with the new method to extract the text part
// might be an html email, try to get the text anyway
var ht = message.HtmlBody;
if (!string.IsNullOrWhiteSpace(ht))
{
theBody = "**** HTML-ONLY MESSAGE ****";
theBody += "\r\n=-=-=-=- TEXT CONVERSION =-=-=-=-\r\n";
theBody += StripHTML(ht, true);
theBody += "\r\n=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-";
theBody += "\r\n=-=-=-=- SOURCE HTML =-=-=-=-\r\n";
theBody += ht;
theBody += "\r\n=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-";
theBody += "\r\n******* END MESSAGE *******";
theBody = StripHTML(ht, true);
theBody += "> ";
theBody = theBody.Replace("\r\n", "\r\n> ").Trim().TrimEnd('>');
theBody ="\r\n"+theBody;//descend the first line under the On you wrote bit
}
else
{
theBody = "NO MESSAGE BODY WAS FOUND NEITHER HTML NOR TEXT";
theBody = "> Source Message Empty";
}
quoted.WriteLine(theBody);
}
sb.AppendLine(theBody);
*/
using (var reader = new StringReader(message.TextBody))
else
{
string line;
while ((line = reader.ReadLine()) != null)
//has a text body so go with old method
using (var reader = new StringReader(message.TextBody))
{
quoted.Write("> ");
quoted.WriteLine(line);
string line;
while ((line = reader.ReadLine()) != null)
{
quoted.Write("> ");
quoted.WriteLine(line);
}
}
}
reply.Body = new TextPart("plain")
{
Text = replyBody + "\r\n\r\n\r\n" + quoted.ToString()