[Last Call] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 311
  • Last Modified:

Strange behavior using Long HTML string and CDO

I am sending HTML email using CDO in VB 6.0. The html string is about 10,000 characters long.  I notice random characters in the email body.  When I format the HTML by putting vbCrLf at the end of each line in the VB code the email looks fine.  Does anybody know why this is happening.  The HTML is well formed (<html><body> ... </body></html>)

Thanks in advance,
1 Solution
Shiju SasidharanCommented:
are u sure u used HTMLBody  instead of TextBody
that is like this

   objMessage.HTMLBody = "<html><body> ... </body></html>"

'The line below shows how to send using HTML included directly in your script
objMessage.HTMLBody = "<html><body> ... </body></html>"

'The line below shows how to send a webpage from a remote site
'objMessage.CreateMHTMLBody "http://www.experts-exchange.com/"

'The line below shows how to send a webpage from a file on your machine
'objMessage.CreateMHTMLBody "file://c|/temp/test.htm"

for more details


nicholsfAuthor Commented:
I am sure I am using HTMLBody.  
I have seen this same thing happen in the Translation of message before.   I built a component which I don't have on hand at the moment, but here is the basic Idea.

some characters get translated through as special characters.   The Special Characters NEED to be in HTML Code.   Example.

for i = 128 to 255
    sMsg = Replace(sMsg, chr(i), "&" & i & ";")

'Translatting Character # 155 into &155;  (the html equivilent)
typically once you leave the first 127 character codes, They go up for grabs.   This is a dumb fix, but it worked for me.   I beleave it was from 128 to 255, but 128 might be too high or too low.  I think My code may have settled at 104, but try it and see if it works.
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

nicholsfAuthor Commented:
I guess I'm wondering if this is a known bug.  I don't think I want to translate characters in the text.
Shiju SasidharanCommented:
try by setting CharSet Property

            objMessage.BodyPart.Charset = cdoUTF_8
nicholsfAuthor Commented:
This is a known bug with SMTP.  I ended up adding CR + LF at the end of each html line and it works fine.

PAQed with points refunded (500)

Community Support Moderator

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now