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

Technology Partners: 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

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.
A short article about problems I had with the new location API and permissions in Marshmallow
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…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

738 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