Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

HTML content type for CDONTS email

Posted on 2003-12-11
5
Medium Priority
?
337 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
[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
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 200 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

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
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…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

636 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