Problems with CDO or SMTP

I'm using CDO for Win2k and IIS Smtp to send HTML formated emails through a visual basic application.
Only probelm is the CDO object  or smtp server seems to be removing characters from the HTML Text
for example in the code i would have

iConf = New Configuration
iMsg = New Message
dim body as string

body = "<HTML>"
...
body = body &  "<a href='clickhere.html'>click here</a>"
...
body = body &  "</HTML>"

'APPLY THE SETTINGS TO THE MESSAGE
With iMsg
            .Configuration = iConf
            .From = FromName
            .Sender = FromEmail
            .To =  ToName
            .BCC = EmailBCCAddress
            .ReplyTo = EmailReplyAddress
            .Subject = UserMessage
            .HTMLBody = body
            .Send()
End With

But when i send the message the link in the body looks like:
<a href='clickherehtml'>click here</a>

The period is missing from the href attribute. It seems to do this for no reason.

I know its not the email client removing the period because i've sent it to a couple different clients and get the same result each time.

TIA
prodierAsked:
Who is Participating?
 
NetminderCommented:
Closed, 500 points refunded.
Netminder
Site Admin
0
 
sbennettsCommented:
Don't you need double quotes around the attribute in HTML.  Replace your single quotes with TWO double quotes and try again.

So in your VB app, do something like...
-----------------------------------------------
iConf = New Configuration
iMsg = New Message
dim body as string

body = "<HTML>"
...
body = body &  "<a href=""clickhere.html"">click here</a>"
...
body = body &  "</HTML>"
-----------------------------------------------

Regards
Simon
0
 
prodierAuthor Commented:
HTML supports both single and double quotes, but i tried your suggestion anyway and get the same result
thanks
0
Get expert help—faster!

Need expert help—fast? Use the Help Bell for personalized assistance getting answers to your important questions.

 
DhaestCommented:
Looking at the next article, i don't think it's necesarry to include the "html"-tag because it won't be shown in the email.

USING HTML FORMATTING
If you want to include formatting in the body text, you can use HTML formatting.With HTML, you can specify the font style, add bold or italic, or use bulleted lists.In fact, you can use just about any formatting available in HTML. To use HTML formatting in body text, you set the HTMLBody property to a legitimate HTML string. For example, the following code sample uses HTML formatting to create body text with a header, a rule, italic, and special font styles in the text:
msg.HTMLBody = _
"<H1>Check this out!</H1>" & _
"<HR><i>Look</i>" & _
" at this " & _
"<font color=red size=12>cool</font>" & _
" HTML message."
When you create an HTML body, by default CDO also generates a plain-text version of the body text. The plain-text version of the body uses the same text as the HTML body but without any special HTML formatting. This ensures that clients unable to process HTML-formatted messages can still read the message. If you would rather not automatically generate a plain-text version of the body text, set the AutoGenerateTextBody property to False. Then, if you prefer to create a plaintext body, you can do so by setting the TextBody property to the value you want.
For example, Listing 6.2 shows how to create a message with two different formats
for the body text.
Listing 6.2 Generate a message with both a text body and an HTML body.
Public Sub CreateSeparateTextandHTML()
' Use both an HTML and plain text
' version for body text formatting.
' If you are using VBScript, use this With:
' With CreateObject("CDO.Message")
With New CDO.Message
.From = "mindy@domain.com"
.To = "peter@domain.com"
.Subject = _
"This message has two different body text versions"
' Generate body text for plain text viewers
.TextBody = _
"You're missing out by not supporting HTML!"
' Generate body text for HTML capable viewers
.HTMLBody = _
"<H1>Check this out!</H1>" & _
"<HR><i>Look</i>" & _
" at this " & _
"<font color=red size=12>cool</font>" & _
" HTML message."
' Send the message
.Send
End With
Debug.Print "Message sent."
End Sub

Source: http://www.thaifast.com/Microsoft_Books/Sample/607729c06.pdf
0
 
JTrainCommented:
what about
body = body &  "<a href=" & chr(34) & "clickhere" & chr(46) & "html" & chr(34) & ">click here</a>"
0
 
prodierAuthor Commented:
The issue is that the SMTP server is mangling parts of the HTML.
The HTML is properly formatted, as i've ran it through a XHMTL parser, when I assigned it to the .HTMLBody Property of the CDO Object.
The CDO object then puts a .eml file in the c:\inetpub\mailroot\pickup folder, the IIS SMTP watched this folder for files.
At this point the HTML in the .eml file is still fine, no periods removed.
After the ISS smtp server finds the file it moves it to the c:\inetpub\mailroot\queue folder, where it sits until the email is sent.
The file that is put in the c:\inetpub\mailroot\queue folder has the period removed
Its like the iss smtp is having trouble when a period is the 72 second character
I know a period is supposed to signal the end of the message in a smtp conversation maybe that has something to do with it
0
 
OHDev2004Commented:
Maybe this'll help :) i didn't try it ,, but it may work
try to change the Dot (.) into "%2e"
like
 body = body &  "<a href='clickhere%2ehtml'>click here</a>"
hope this is not too dumb ,, lol
OHDev
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.