Solved

HTML content type for CDONTS email

Posted on 2003-12-11
5
327 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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

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…
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
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…

809 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