Solved

HTML content type for CDONTS email

Posted on 2003-12-11
5
322 Views
Last Modified: 2013-12-03
Hi all

I'm sending an email with HTML body. When i receive the email the message source shows content_type : "Text/Plain" and then again "Text/html". All the fonts and style sheets don't have any effect. How can i get rid of this problem.

Dim myMail
Set myMail = CreateObject("CDONTS.NewMail")

HTML = "<!DOCTYPE HTML PUBLIC ""-//IETF//DTD HTML//EN"">" & vbCrLf
            HTML = HTML & "<html>"
            HTML = HTML & "<head>"
            HTML = HTML & "<meta http-equiv=""Content-Type"""
            HTML = HTML & "content=""text/html; charset=iso-8859-1"">"
            HTML = HTML & "<title>Sample NewMail</title>"
            HTML = HTML & "</head>"
            HTML = HTML & "<body class='12normal' >"
            HTML = HTML & "This is an HTML test e-mail. <BR></body>"
            HTML = HTML & "</html>"

myMail.From = "Example@microsoft.com"
myMail.To = "Someone@microsoft.com"
myMail.Subject = "Sample Message"
myMail.BodyFormat = 0
myMail.MailFormat = 0
myMail.Body = HTML
myMail.Send
Set myMail = Nothing

This is how my email body looks like. When i send the email the content-type is "text/plain" and all the formatting is lost.
The message source shows something like this:

Content-Type: text/plain;
      charset="iso-8859-1"
Content-Transfer-Encoding: 7bit

This is a sample message being sent using HTML.


------=_NextPart_000_0018_01C3BE62.FCFE9100
Content-Type: text/html;
      charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<html><head><meta http-equiv=3D"Content-Type"content=3D"text/html; =
charset=3Diso-8859-1"><title>Sample NewMail</title></head><body>This is =
a sample message being sent using HTML. <BR></body></html>

How can i get rid of this content type plain text?? Is it a problem with CDONTS setting ?

0
Comment
Question by:anamika1977
5 Comments
 
LVL 3

Expert Comment

by:rhoggren
ID: 9920422
To be honest, I'm not so sure Style Sheets work in Outlook when viewing email.

Have you tried manually formatting the text to see if that works?
0
 
LVL 26

Accepted Solution

by:
Alan Warren earned 50 total points
ID: 9933119
To send an email with HTML, set the BodyFormat to 1, and the Body of the email as HTML.


myMail.BodyFormat = 1

Alan :)
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

706 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

12 Experts available now in Live!

Get 1:1 Help Now