Gmail chooses MIME-type “text/plain” over MIME-type “text/html”

Problem

When sending out email through .NET, I sometimes use the MailMessage.AlternateViews collection to offer email-clients to choose between an html- and a plain-text-version of the message.

However, recently I found a problem, where – when providing these 2 options for the receiving client – Gmail would always choose the plain-text version, although Gmail most certainly can display html.

Solution

It seems, that Gmail will always choose the latter of the 2 options (in this case only? I don’t know), so you should simply add the AlternateView with MIME-type “text/plain” before the “text/html” one.

References

http://www.bennadel.com/blog/188-GMail-Chooses-ONLY-Non-HTML-Mail-If-Given-The-Option.htm (Tim-dude in comment)

http://social.msdn.microsoft.com/Forums/en/csharpgeneral/thread/2b22fdbe-af6d-4c90-ae30-3c8b109c0818 (Franklin Neves in comment)

Start the conversation