Home > ASP Development > Asp And Cdosys

Asp And Cdosys



I have used CDOSYS and asp for ages and occasionally when i send an email using HTML format it tends to miss characters at random from the HTML, which means when the email is received the formatting is wrong as it misses parts of the text like td align will come up in the email as td alin meaning the email doesnt diplay properly.



Anybody have any ideas on how to fix this problem? Please help

    
Guest


Got a more concrete example? Doesn't seem to make sense that this would be completly random, what's the pattern?

Was this answer helpful ? Yes No   
Guest


here is the html text generated and the CDOSYS is the norm with objCDOSYSMail.HTMLBody = HTML




Code:


HTML = "<html><head><style type='text/css'><!-- body {margin-left: 0px;margin-top: 0px;margin-right: 0px;margin-bottom: 0px;} body,td,th {font-family: Arial, Helvetica, sans-serif;font-size: 12px;color: #000000;}--></style></head>"
HTML = HTML & "<body bgcolor='#ffffff' link='#999999' vlink='#999999' alink='#999999' leftmargin='0' marginheight='0' marginwidth='0' topmargin='0'><table width='580' border='0' align='center' cellpadding='0' cellspacing='0'><tr><td height='150' valign='top'><table width='100%' border='0' cellspacing='0' cellpadding='0'><tr><td><div align='right'><font color='#999999' size='2' face='Arial, Helvetica, sans-serif'>Robinson Media </font><font color='#999999' size='2' face='Arial, Helvetica, sans-serif'><br><font size='1'>Unit 5, Ashbourne Court<br>Manners Industrial Estate<br>Ilkeston<br>DERBYSHIRE<br>DE7 8EF</font><br><br>Tel: 0115 930 8333<br>Fax: 0115 944 4938</font></div></td><td width='15'>&nbsp;</td><td width='149'><img src='robmedia.jpg'></td></tr></table></td></tr><tr>"
HTML = HTML & "<td valign='top'><table width='5580' border='0' cellspacing='0' cellpadding='0'><tr valign='top'><td width='275'>" & (estimate.Fields.Item("CompanyName").Value) & "<br>" & replace((estimate.Fields.Item("Address").Value),",","<br>") & "<br>" & (estimate.Fields.Item("District").Value) & "<br>" & (estimate.Fields.Item("County").Value) & "<br>" & (estimate.Fields.Item("Postcode").Value) & "<br>" & (estimate.Fields.Item("Tel").Value) & "<br>" & (estimate.Fields.Item("Fax").Value) & "<br>" & (estimate.Fields.Item("EmailAdd").Value) & "</td><td><div align='right'>Estimate No. <strong> " & (estimate.Fields.Item("ENumber").Value) & "</strong><br><br>Date: " & DoDateTime((estimate.Fields.Item("EDate").Value), 1, 2057) & "</div></td></tr></table></td></tr><tr><td>&nbsp;</td></tr><tr><td>For the attention of " & (estimate.Fields.Item("EContact").Value)
HTML = HTML & "</td></tr><tr><td>&nbsp;</td></tr><tr><td>Dear " & (estimate.Fields.Item("EContact").Value) & "<br>Further to your recent enquiry, we have pleasure submitting the following estimate </td></tr><tr><td>&nbsp;</td></tr><tr><td><table width='580' border='0' cellspacing='0' cellpadding='0'><tr><td width='180'><strong>Title:</strong></td><td>" & (estimate.Fields.Item("ETitle").Value) & "</td></tr><tr><td>&nbsp;</td><td>&nbsp;</td></tr><tr><td><strong>Size:</strong></td><td>" & (estimate.Fields.Item("ESize").Value)
HTML = HTML & "</td></tr><tr><td>&nbsp;</td><td>&nbsp;</td></tr><tr><td><strong>Origination:</strong></td><td>" & (estimate.Fields.Item("EOrig").Value) & "</td></tr><tr><td>&nbsp;</td><td>&nbsp;</td></tr><tr><td><strong>Proofs:</strong></td><td>" & (estimate.Fields.Item("EProof").Value) & "</td></tr><tr><td>&nbsp;</td><td>&nbspp;</td></tr><tr><td><strong>Material:</strong></td><td>" & (estimate.Fields.Item("EMaterial").Value)
HTML = HTML & "</td></tr><tr><td>&nbsp;</td><td>&nbsp;</td></tr><tr><td><strong>Colours on side 1:</strong></td><td>" & (estimate.Fields.Item("ECS1").Value) & "</td></tr><tr><td><strong>Colours on side 2:</strong></td><td>" & (estimate.Fields.Item("ECS2").Value) & "</td></tr><tr><td>&nbsp;</td><td>&nbsp;</td></tr><tr><td><strong>Finishing:</strong></td><td>" & (estimate.Fields.Item("EFinish").Value) & "</td></tr><tr><td>&nbsp;</td><td>&nbsp;</td></tr><tr><td><strong>Delivery:</strong></td><td>" & (estimate.Fields.Item("EDelivery").Value) & "</td></tr><tr><td>&nbsp;</td><td>&nbsp;</td></tr></table></td></tr><tr><td><table width='580' border='0' cellspacing='0' cellpadding='0'><tr><td width='180'><strong>Quantities:</strong></td><td width='100'><div align='right'><strong>"
if (estimate.Fields.Item("EQ1").Value) <> 0 then
HTML = HTML & (estimate.Fields.Item("EQ1").Value)
else
HTML = HTML & "&nbsp;"
end if
HTML = HTML & "</strong></div></td><td width='100'><div align='right'><strong>"
if (estimate.Fields.Item("EQ2").Value) <> 0 then
HTML = HTML & (estimate.Fields.Item("EQ2").Value)
else
HTML = HTML & "&nbsp;"
end if
HTML = HTML & "</strong></div></td><td width='100'><div align='right'><strong>"
if (estimate.Fields.Item("EQ3").Value) <> 0 then
HTML = HTML & (estimate.Fields.Item("EQ3").Value)
else
HTML = HTML & "&nbsp;"
end if
HTML = HTML & "</strong></div></td><td><div align='right'><strong>"
if (estimate.Fields.Item("EQ4").Value) <> 0 then
HTML = HTML & (estimate.Fields.Item("EQ4").Value)
else
HTML = HTML & "&nbsp;"
end if
HTML = HTML & "</strong></div></td></tr><tr><td><strong>Prices:</strong></td><td><div align='right'><strong>"
if (estimate.Fields.Item("EP1").Value) <> 0 then
HTML = HTML & FormatCurrency((estimate.Fields.Item("EP1").Value), 2, -2, -2, -2)
else
HTML = HTML & "&nbsp;"
end if
HTML = HTML & "</strong></div></td><td><div align='right'><strong>"
if (estimate.Fields.Item("EP2").Value) <> 0 then
HTML = HTML & FormatCurrency((estimate.Fields.Item("EP2").Value), 2, -2, -2, -2)
else
HTML = HTML & "&nbsp;"
end if
HTML = HTML & "</strong></div></td><td><div align='right'><strong>"
if (estimate.Fields.Item("EP3").Value) <> 0 then
HTML = HTML & FormatCurrency((estimate.Fields.Item("EP3").Value), 2, -2, -2, -2)
else
HTML = HTML & "&nbsp;"
end if
HTML = HTML & "</strong></div></td><td><div align='right'><strong>"
if (estimate.Fields.Item("EP4").Value) <> 0 then
HTML = HTML & FormatCurrency((estimate.Fields.Item("EP4").Value), 2, -2, -2, -2)
else
HTML = HTML & "&nbsp;"
end if
HTML = HTML & "</strong></div></td></tr></table></td></tr><tr><td>&nbsp;</td></tr><tr><td>Your Sincerely,<br><br>" & (estimate.Fields.Item("EUser").Value) & "</td></tr></table></body></html>"






now depending on what code is rendered the errors come in different parts of the file, that is why i am having probelms, as i can force extra characters into the code, but then if the 'IF' statements change the error is in a different place



further tests have found that the HTML string created cuts off 2 characters around about the 2232nd - 2234th character and then continues as normal

Was this answer helpful ? Yes No   
Guest


I have been having a similar problem for along time now with HTML formatted text being sent using CDOSYS. Sometimes emails arrive with no problem but frequently parts of the text in the body of the message are missing and usually a ! character has been inserted somehow where the text is missing. This not only messes up the text but if I am sending a hyperlink it messes up the link. It is most strange as there seems to be no repeatable pattern to things !! Have you had any luck finding a cause or even a solution ??? It seem to occur more often where I concatenate strings.



Here is one examples of the code I am using:-



Set myMail = CreateObject("CDO.Message")

strBody="<html>"

strBody=strBody & "<body>"

strBody=strBody & "<font face=Arial size=2><a href=http://example.com/drilldown.asp?acid=" & ACID & ">Intranet</a> / <a href=https://example.com/drilldown.asp?acid=" & ACID & ">Portal</a> Text</font>"

strBody=strBody & "<br>"

strBody=strBody & "<br>"

strBody=strBody & "<font face=Arial size=2>Text <a href=http://example.com/feedback.htm>Intranet</a> / <a href=https://example.com/feedback.htm>Portal</a> Text</font>"

strBody=strBody & "<br>"

strBody=strBody & "</body>"

strBody=strBody & "</html>"

myMail.From="example@example.com"

myMail.To="example@example.com"

myMail.Subject="Tex " & ACID & " Text."

myMail.HTMLBody=strBody

myMail.Send

Set myMail = Nothing

Was this answer helpful ? Yes No   
Guest
 
 
Home - About Infoqu - Contact - Privacy Statement - Link to Infoqu - Bookmark Infoqu

Copyright 2007-2008 by Infoqu. All rights reserved