Go Premium for a chance to win a PS4. Enter to Win

x
?
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
Medium Priority
?
337 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
5 Comments
 
LVL 8

Accepted Solution

by:
SNilsson earned 128 total points
ID: 9670771
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 124 total points
ID: 9673464
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 124 total points
ID: 9676648
you need to use some third parties smtp email component which supports multipart mail format
0
 
LVL 1

Assisted Solution

by:eScapePro
eScapePro earned 124 total points
ID: 9677863
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
ID: 14123137
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

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Make the most of your online learning experience.
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…

773 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