更新时间:2022-12-03 09:40:45
所以,我想弄清楚实际问题是什么它在这一行
So, I think figured out what the actual problem is Its in this line
// Alternate view for embedded images
AlternateView avText = AlternateView.CreateAlternateViewFromString(metric.Name, null, MediaTypeNames.Text.Html);
AlternateView avImages = AlternateView.CreateAlternateViewFromString(htmlBody, null, MediaTypeNames.Text.Html);
如您所见,我的两个视图都指定为 Text.Html,因此第一个视图覆盖了下一个视图,因此我只看到文本和图像作为附件发送
As you can see, both my views are specified as Text.Html, so the the 1st one is overriding the next one and so I only see text and images are sent as attachments
我进行了以下更改并按预期工作
I made the following change and it worked as expected
AlternateView avText = AlternateView.CreateAlternateViewFromString(metric.Name, null, **MediaTypeNames.Text.Plain**);
AlternateView avImages = AlternateView.CreateAlternateViewFromString(htmlBody, null, MediaTypeNames.Text.Html);