Wrox Programmer Forums
Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
ASP.NET 2.0 Professional If you are an experienced ASP.NET programmer, this is the forum for your 2.0 questions. Please also see the Visual Web Developer 2005 forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the ASP.NET 2.0 Professional section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old November 27th, 2008, 01:49 AM
Registered User
Join Date: Nov 2008
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Urgent - Send mail with plain view and html view


I need to send a mail in both formats together (plain text + HTML) so that if on any email client(like Outlook, Thunderbird etc) HTML view is disabled, the plain text should be displayed.

Things that are already tried:
While sending the mail I am creating an "AlternateView" for both plain Text and HTML and assigning it to the Message object. Below shown is the code:

SmtpClient smtpClient = new SmtpClient();
System.Net.Mail.MailMessage message = new System.Net.Mail.MailMessage(fromAddress, toAddress);

message.Subject = subject;

// Add the alternate body to the message (Plain text message) . The parameter "body" contains the plain text.
AlternateView plainView = AlternateView.CreateAlternateViewFromString(body);
plainView.ContentType = new ContentType("text/plain");

// Add the alternate body to the message (HTML message) . The parameter "htmlBody" contains the HTML text
AlternateView htmlView = AlternateView.CreateAlternateViewFromString(htmlBo dy);
htmlView.ContentType = new ContentType("text/html");




The mail was sent successfully but the problem here is with testing Plain View. In Outlook I selected the option to "Read all Std. Mails in Plain Text" but contents of the mail is HTML conversion into normal text but not the Plain Text view. In mail header the content type shows : multipart/alternative.
This functionality was even tested on Thunderbird on Windows as well as on Apple mail client but is not working as expected.

Appreciate any help to display Plain + HTML view on email client.

Similar Threads
Thread Thread Starter Forum Replies Last Post
any idea to view xml as it is but in hieratic view seco XSLT 2 January 17th, 2008 08:49 AM
Help Grid View Drop Down List, view all jskinner123 ASP.NET 2.0 Basics 0 November 25th, 2007 06:25 PM
HTML - no View Source GreenLamar HTML Code Clinic 1 August 9th, 2007 03:19 PM
populate details view or list view non empty rows iinfoque ASP.NET 2.0 Basics 0 March 11th, 2007 06:11 AM
tree view delete..Urgent help plz chandler7272 C# 1 June 23rd, 2006 06:34 PM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.