Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP.NET 2.0 > ASP.NET 2.0 Professional
Password Reminder
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Display Modes
  #1 (permalink)  
Old November 27th, 2008, 12:49 AM
Registered User
Join Date: Nov 2008
Location: , , .
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.


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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 07:49 AM
Help Grid View Drop Down List, view all jskinner123 ASP.NET 2.0 Basics 0 November 25th, 2007 05: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

All times are GMT -4. The time now is 05:21 PM.

Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.