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
312 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
8 Comments
 
LVL 8

Accepted Solution

by:
SNilsson earned 32 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 31 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 31 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 31 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
egit plugin on eclipse 8 98
Filename to be appended with DateTimeof Download 3 69
How to Have Macro Files Automatically "Edit" 5 48
statistics basics sources 2 38
This is an explanation of a simple data model to help parse a JSON feed
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 …
In this fifth video of the Xpdf series, we discuss and demonstrate the PDFdetach utility, which is able to list and, more importantly, extract attachments that are embedded in PDF files. It does this via a command line interface, making it suitable …

756 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