开发者

html ws text emails - how to show html version in gmail?

I added plain text version to system generated emails, because email without text version is considered as spam. Here is my code:

MailMessage mm = new MailMessage(
new MailAddress(from, msg.FromName), new MailAddress(msg.ToEmail, msg.ToName)); 
mm.Subject = msg.Subject;
mm.Body = msg.Body;
mm.IsBodyHtml = 1;
mm.Priority = MailPr开发者_JAVA百科iority.Normal;
ContentType plainContentType = new ContentType("text/plain");
AlternateView plainTextView = AlternateView.CreateAlternateViewFromString(msg.BodyTxt, plainContentType);
mm.AlternateViews.Add(plainTextView);

It works great, but now my problem is that such systems as gmail show back up text version, not main html version!

So far i discovered that email consist from 2 parts:

Content-Type: ***text/plain***; charset=utf-8
Content-Transfer-Encoding: base64

and

Content-Type: text/plain
Content-Transfer-Encoding: base64

First one is larger and it must be the HTML version (as you see, I set IsBodyHtml to true). Any ideas?


Solution was to put text version to Body, and add text/html version as ALternateView

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜