p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/)
-   Classic ASP Professional (http://p2p.wrox.com/classic-asp-professional-63/)
-   -   CDO email - character 1023 drops out! (http://p2p.wrox.com/classic-asp-professional/52542-cdo-email-character-1023-drops-out.html)

BananaJim January 10th, 2007 03:10 PM

CDO email - character 1023 drops out!
 
Bizarre thing here - can you help?

I have an ASP page that builds a string and then sends it as an HTML email using the CDO object. All standard stuff. Here is code:

----------------------------------------

Set myMail=CreateObject("CDO.Message")
myMail.Subject="ONLINE LEARNING AND TESTING"
myMail.From="x@xxx.com"
myMail.To="x@xxx.com"

eText = <long string containing 1,640 characters>

myMail.HTMLBody = eText

with myMail
        .Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
        .Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "smtp.xxx.com"
        .Configuration.Fields.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
        .Configuration.Fields.Update
end with

myMail.Send

----------------------------------------

The email is sent successfully.

Now... when I do response.write(eText), the browser shows the text perfectly. But when the email arrives in my inbox, get this:

THE 1023rd CHARACTER IS MISSING!!!!!

This is disastrous, since in some cases this is one of the characters of important user login details contained within the email. In other cases, the 1023rd character is one of the HTML formatting characters, which means that the formatting of the HTML email becomes corrupted.

WHY is this happening? Is it a bug with the CDO object?

Please help to solve this for me... it is very urgent!

Thanks.

Jim

BananaJim January 10th, 2007 04:06 PM

No idea why it happens. However, here is a temporary solution (very easy but took me ages to see it!!)

-------------------

    if Len(eText) >= 1023 then

        eText = Left(eText,1022) & "X" & Right(eText, Len(eText) - 1022)

    end if

-------------

i.e. just stick a spurious character (X) at position 1023 and let it get knocked out! I guess the same will happen at all multiples of 1023 as well.



All times are GMT -4. The time now is 02:31 AM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
2013 John Wiley & Sons, Inc.