1

I vaguely recall reading -somewhere- that the order in which an AlternateView is added to the MailMessage.AlternateViews collection matters when determining which AlternateView should be displayed. I recall it being based on the ability to display the message and, if the device doesn't support HTML for example, fallback to HTML. Unfortunately, I can't find the original article nor any other article mentioning how this should work.

Does the order in which an AlternateView gets added to the MailMessage.AlternateViews collection matter? If so, how does it work? Any documentation?

anar khalilov
  • 16,993
  • 9
  • 47
  • 62
DenaliHardtail
  • 27,362
  • 56
  • 154
  • 233
  • @AnarKhalilov How is MIME not a relevant tag? The MailMessage.AlternateViews is a list of MIME multipart/alternative - and the answer to the question is specified in the RFC for MIME. – Luna Jun 03 '15 at 11:57
  • @nallar, thanks for correcting my mistake. :) – anar khalilov Jun 03 '15 at 11:59

1 Answers1

4

The order is important, according to RFC1521 - MIME (Multipurpose Internet Mail Extensions).

In general, user agents that compose multipart/alternative entities must place the body parts in increasing order of preference, that is, with the preferred format last

MailMessage.Attachments does use the order you add them in - so make sure the views are added to that collection in the correct order, with lowest priority first and the preferred (probably text/html) view last.

Community
  • 1
  • 1
Luna
  • 1,447
  • 1
  • 18
  • 32
  • 1
    Upvoted as factual. However there's a catch if you're targeting Outlook users. Microsoft have decided to go against this in favour of their own proprietary standard. In this case the HTML view must be first in the views as discussed at https://stackoverflow.com/questions/22734403/send-email-to-outlook-with-ics-meeting-appointment – EvilDr Feb 23 '22 at 16:23