Solved

HTML content type for CDONTS email

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

Salesforce Has Never Been Easier

Improve and reinforce salesforce training & adoption using WalkMe's digital adoption platform. Start saving on costly employee training by creating fast intuitive Walk-Thrus for Salesforce. Claim your Free Account Now

Question has a verified solution.

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

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 have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
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…

691 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