public static IEnumerable <AlternateView> GetEffectiveBodyViews(this IEmailMessage mailItem) { yield return(AlternateView.CreateAlternateViewFromString(mailItem.Body.RemoveHtmlTags(), new ContentType("text/plain; charset=UTF-8"))); if (mailItem.Html) { var htmlView = AlternateView.CreateAlternateViewFromString( mailItem.Body, new ContentType("text/html; charset=UTF-8")); htmlView.LinkedResources.AddRange(mailItem.GetLinkedResources()); yield return(htmlView); } if (mailItem.VCalendarView.HasValue()) { var calendarType = new ContentType("text/calendar"); calendarType.Parameters.Add("method", "REQUEST"); calendarType.Parameters.Add("name", "meeting.ics"); var calendarView = AlternateView.CreateAlternateViewFromString(mailItem.VCalendarView, calendarType); calendarView.TransferEncoding = TransferEncoding.SevenBit; yield return(calendarView); } }