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
293 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
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

I know it’s not a new topic to discuss and it has lots of online contents already available over the net. But Then I thought it would be useful to this site’s visitors and can have online repository on vim most commonly used commands. This post h…
Since upgrading to Office 2013 or higher installing the Smart Indenter addin will fail. This article will explain how to install it so it will work regardless of the Office version installed.
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 …
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

910 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

17 Experts available now in Live!

Get 1:1 Help Now