When I send an html email with an attached file, Plain Text on Thunderbird doesn't show anything, especially when an attached file is docx, pdf, or etc. txt file was okay when I tested though.
It works well if I don't attach any files, Thunderbird correctly shows Html Text and Plain Text if I switch its view setting.
using(var mail = new MailMessage()){
// ...omit
var alternateView = AlternateView.CreateAlternateViewFromString("<h1>TEST</h1>", Encoding, MediaTypeNames.Text.Html);
alternateView.TransferEncoding = TransferEncoding.SevenBit;
mail.AlternateViews.Add(alternateView);
mail.Attachments.Add(new Attachment("path to a file"));
// ...omit
}
I tried https://stackoverflow.com/a/2828438/366049 but no luck.
--EDITED--
As Caius Jard suggested, I tried the following and the results are below.
- setting it as the main body + the HTML as an alternateview
It works, but this means I have to prepare plain text and html text. If I don't attach any files, Thunderbird shows plain text which is from html text removing tags. I want this behavior all the time since input text is made by our users. Otherwise I need to retrieve plain text from html. - setting both the text and the HTML as alternate views, no main body
Both Plain Text and Html Text settings in Thunderbird show the text alternate view. - setting the text as both the main body and a text alternateview as well as having an HTML alternateview
Thunderbird shows the text alternate view even if I switch its view setting.
According to these experiments, a plain alternate view is superior than an html alternate view and a main body.