Solved

How do I send a single mail out that has both HTML content and Text content (asp.net)

Posted on 2003-11-03
8
281 Views
Last Modified: 2010-04-17
I'm trying to send a mail out that has both HTML content and Text content. Depending on the recipients mail program(can it read text or html) they will either then see the mail as Text or as an HTML.

Currently I can do this:
mail.From = “me@webaddress.com”
mail.Body = “this is my body it is my temple”
mail.BodyFormat = MailFormat.Html
mail.Subject = “this is my subject”
SmtpMail.SmtpServer = “This is my server IP”
mail.To = “friend@webaddress.com”
SmtpMail.send(mail)

Obviously I could change the body format to .text, but then the html woulld not go through. Any Ideas?
0
Comment
Question by:KevinAnanzi
8 Comments
 
LVL 8

Accepted Solution

by:
SNilsson earned 32 total points
Comment Utility
Maybe you should use html always and include the text only as an attatchment.

Since you dont know the recipients mail program or settings, I dont see any other way, if the recipient have text only the body will be rather ugly with html, so maybe you should have the html as attatchment.
0
 
LVL 16

Assisted Solution

by:JohnBPrice
JohnBPrice earned 31 total points
Comment Utility
The .net mailmessage component doesn't support multipart/alternative mail format, which is what you need to include both HTML and Text formats.  Other controls do, see www.devmail.net, for example.

You might be able to trick it however, by setting the appropriate header values and including both in the body separated by the appropriate boundry characters.

0
 
LVL 9

Assisted Solution

by:bhagyesht
bhagyesht earned 31 total points
Comment Utility
you need to use some third parties smtp email component which supports multipart mail format
0
 
LVL 1

Assisted Solution

by:eScapePro
eScapePro earned 31 total points
Comment Utility
You have a number of choices

1. You can have the html version on the web and then send the e-mail with a small bit of html script + text. the html script loads in the html version if the person has html mail else the text only is visible

2. send the html version as an attachment and the text as the body. but send a html header or VB Script in the mail that gets run if the user has html mail and then replaces in the html

3. Send the text version but have a link to the html version on the web. there you can also ask if the user would like a html version next time...
0
 
LVL 1

Expert Comment

by:jtwright
Comment Utility
I would design your form as a user control and use css to change the appearance of the form form and controls themselves.  

Once you have done that then you can use dreamweaver or whatever "design" program to design a strong looking template.  Once you have designed the template, then it is just a matter of dropping the user control into your template, using the correct syntax of course.
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
mapBully challenge 6 88
pairs challenge 5 44
move one pixel 4 41
recursion example 16 68
This article is meant to give a basic understanding of how to use R Sweave as a way to merge LaTeX and R code seamlessly into one presentable document.
Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

8 Experts available now in Live!

Get 1:1 Help Now