View Sidebar
Gmail Showing Plain Text Version

Gmail Showing Plain Text Version

January 30, 2009 11:03 am3 comments

I was just tweaking some code that sends out email. I noticed in Gmail that the plain text version of the email was being shown even though it was a multipart message with both plain text and HTML alternatives provided.


MailMessage msg = new MailMessage();
System.Net.Mail.AlternateView htmlView;
System.Net.Mail.AlternateView plainView;

htmlView = AlternateView.CreateAlternateViewFromString(
           new ContentType("text/html"));

plainView = AlternateView.CreateAlternateViewFromString(
            new ContentType("text/plain"));


The fix was simple: add the plain text view to the message first.  Yup, that’s all it took:



  • Jason

    Thanks very much! This worked for me too. Also, I noticed that the text view version gets displayed as the preview content for the email in question when you are in your Inbox looking at the list of all emails…. which kinda makes sense.

  • Thanks a lot for this help. Very very useful.

  • Ewert

    Thanks a lot this was a real head ache. Didn’t think it would be such a simple solution. Thought that adding the Html AlternateView first would make that one priority over the other. But oh well…