Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ASP Classic CDOSYS Email via HTMLBody format

I have an issue sending an email using CDOSYS messaging system in ASP Classic using HTMLBody format. It seems to have a character limit, and when the email message is being sent, it cuts the message off around the bottom of the email. At first, I thought the message was being sent before the entire email could be written, but then after some troubleshooting and research, there is some sort of CDOSys message character limit when using HTMLBody. My question is, is there any way to override the character limit or get around the restriction? This is only for HTMLBODY.

EDIT: The "duplicate" flag would not have helped me. This is not a truncation issue, but an issue with HTMLBody limitations that prevent lengthy messages from fully being sent in the message. I checked that article and it was not what I was looking at an answer to. The responses on this thread were sufficient in answering my question. Thank you all.

Here is my code:

         Set myMail=CreateObject("CDO.Message")


                        HTML = HTML & "<html>"
                        HTML = HTML & "<body>"
                        HTML = HTML & "<font face='calibri'>"

                        HTML = HTML & "<img src='http://" & SupportTagURLWebPath & "/images/SkypeEmailHeader.png'>"
                        HTML = HTML & "<br><Br>"

                        HTML = HTML & "<font face='calibri'>"                   
                        HTML = HTML & "<b>To " & Request.Form("SkypeTemplateName") & ":</b>"
                        HTML = HTML & "<br><br>"

                        HTML = HTML & "Thank you for contacting the Bank of America Service Desk. We're committed to providing seamless support in the moments that matter."
                        HTML = HTML & "<br><br>"                            
                        HTML = HTML & "We heard your concerns with Skype for Business audio/video, and recommend using approved Skype for Business devices to resolve the issue."
                        HTML = HTML & "<br><br>"
                        HTML = HTML & "<h4><font color='red'>What do I need to do?</font></h4>"

                        HTML = HTML & "<div style='background-color: #FFF8DC;'>"
                        HTML = HTML & "1. Visit the <a href='http://u.go/pchk'>Skype for Business Peripheral Checker</a> & complete the form.<br>"
                        HTML = HTML & "<img src='http://" &SupportTagURLWebPath & "/images/SkypeEmailbody.png'><br>"
                        HTML = HTML & "4. Once approved, your new device(s) will be shipped to you. To get started, visit the <a href='http://u.go/tIxvB5'>Skype for Business page</a> and select <i>Setup your equipment</i> tab."                     
                        HTML = HTML & "</div>"
                        HTML = HTML & "<br><br>"

                        HTML = HTML & "<br>"
                        HTML = HTML & "If you still encounter Skype for Business audio/visual issues with your new device(s), please <a href='http://u.go/7I76vm'>submit a web ticket</a> and one of our expert Bank of America Service Desk employees will reach out to you."
                        HTML = HTML & "Thank you,"
                        HTML = HTML & "<br>"
                        HTML = HTML & "Premium Service Desk"            


                        HTML = HTML & "<br><Br>"
                        HTML = HTML & "<img src='http://" & SupportTagURLWebPath & "/images/SkypeEmailFooter.png'>"     

                        HTML = HTML & "</font>"                 
                        HTML = HTML & "</body>"
                        HTML = HTML & "</html>" 



     myMail.Subject= "Skype for Business audio/visual experience"
     myMail.From=EMAILADDRESS
     myMail.To=Request.Form("SkypeTemplateEmail")
     'mymail.CC= Request.Form("displayemail")
     myMail.BCC="[email protected]"
     myMail.ReplyTo="Do Not Reply"
     'myMail.TextBody="This is a message."
     myMail.Configuration.Fields.Item _
     ("http://schemas.microsoft.com/cdo/configuration/sendusing")=2
     'Name or IP of remote SMTP server
     myMail.Configuration.Fields.Item _
     ("http://schemas.microsoft.com/cdo/configuration/smtpserver")="amta3dns.bo.com"
     'Server port
     myMail.Configuration.Fields.Item _
     ("http://schemas.microsoft.com/cdo/configuration/smtpserverport")=25 
    myMail.Configuration.Fields.Update


    'myMail.TextBody= Request.Form("genfeedback") 
    myMail.HTMLBody=HTML

    myMail.Send
     set myMail=nothing 
like image 995
jrp1982 Avatar asked May 22 '17 12:05

jrp1982


2 Answers

It is a line length issue. Without the crlf you blow out the max length at 998 characters. Best thing to do would be to write a function that splits the content in mid-string, avoiding the html tags. HTML text, e.g. in a para, ignores line breaks.

The RFC says

There are two limits that this standard places on the number of characters in a line. Each line of characters MUST be no more than 998 characters, and SHOULD be no more than 78 characters, excluding the CRLF.

The 998 character limit is due to limitations in many implementations which send, receive, or store Internet Message Format messages that simply cannot handle more than 998 characters on a line. Receiving implementations would do well to handle an arbitrarily large number of characters in a line for robustness sake. However, there are so many implementations which (in compliance with the transport requirements of [RFC2821]) do not accept messages containing more than 1000 character including the CR and LF per line, it is important for implementations not to create such messages.

The more conservative 78 character recommendation is to accommodate the many implementations of user interfaces that display these messages which may truncate, or disastrously wrap, the display of more than 78 characters per line, in spite of the fact that such implementations are non-conformant to the intent of this specification (and that of [RFC2821] if they actually cause information to be lost). Again, even though this limitation is put on messages, it is encumbant upon implementations which display messages

Thanks go to the blog at emailonacid for the pointer.

like image 99
Vanquished Wombat Avatar answered Oct 11 '22 00:10

Vanquished Wombat


I was able to figure it out via another thread doing a google search. If you place the below line for every 3-5 lines of the email message, it seems to "reset" or loop the number limit back to the beginning without changing the format of the email. I am not sure if this is the correct way of handling it, but it seems to work for a number of messages I created today which have pretty lengthy messages that would otherwise be cut off when the message is sent. I hope this helps anyone else with this issue.

HTML = HTML & vbCrLf
like image 34
jrp1982 Avatar answered Oct 10 '22 22:10

jrp1982