Link to home
Start Free TrialLog in
Avatar of anamika1977
anamika1977

asked on

HTML content type for CDONTS email

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 ?

Avatar of rhoggren
rhoggren

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?
ASKER CERTIFIED SOLUTION
Avatar of Alan Warren
Alan Warren
Flag of Philippines image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial