A random exclamation mark in the body of a letter using CDO

We get a random exclamation mark (!) In the body of the letter using the CDO object in the classic ASP.

We do not get an exclamation point with a forecast. The problem only occurs with the Lotus Notes client. We use the IIS SMTP server to send email.

Edit

Set myMail= Server.CreateObject("CDO.Message")
myMail.Subject="Business and Company News on your Mobile Device"
myMail.From="no-reply@test.com"
myMail.To="some@email.com"
htmlbody = htmlbody (coming runtime)
myMail.BodyPart.ContentTransferEncoding = "quoted-printable"
myMail.HTMLBody = htmlbody
myMail.Send

I think the client does not use SMTP. But they definitely know LotusNotes.

+3
source share
5 answers

. , ASP, . . , HTML- - HTML.

+6

, , -

 .HTMLBody= psBody
 .HTMLBodyPart.ContentTransferEncoding = "quoted-printable"

So HTMLBodyPart.... BodyPart.....

, , .

+5

, "quoted-printable" , . VbScript, htmlbody . :

<%
'
' **** fix CDOSYS exclamation mark problem - TFI 10/22/2013 - v1.1
'
' This function breaks a string into 76 chars (or less) lines, thus avoiding
' the "exclamation mark" problem when sending e-mails through CDOSYS component
' v.1.1 - fixed a bug that clipped the message at its end

function fixstring(string1)
    Dim string2,pstart,pos0,pos1,part
    string2=""
    pstart=1
    do
        part=mid(string1,pstart,76)
        pos0=instr(part,vbcrlf)
        if pos0=0 then
            pos1=instrrev(part," ")
            if pos1=0 then
                string2=string2&part&vbcrlf
                pstart=pstart+76
            else
                string2=string2&left(part,pos1)&vbcrlf
                pstart=pstart+pos1
            end if  
        else
            string2=string2&left(part,pos0)&vbcrlf
            pstart=pstart+pos0
        end if  
    loop while pstart<len(string1)
    fixstring=string2
end function

string1="Lorem ipsum dolor sit"&vbcrlf&"amet, consectetur adipiscing elit. Sed in dignissim risus. Vestibulum ac justo sed massa posuere pellentesque non et odio. Suspendisse scelerisque sed ante in ullamcorper. Sed vel diam sed ligula commodo aliquet. Fusce aliquam eleifend arcu, vitae euismod purus pellentesque ac. In adipiscing, eros a semper semper, magna ligula volutpat dui, a vulputate nisl tellus a nisi. Donec et fringilla tellus. Praesent nibh neque, hendrerit ut fringilla eget, condimentum nec ligula. Mauris porta et velit et faucibus. Morbi aliquam risus urna, eu ultricies purus venenatis eget. Donec elementum ante dictum, euismod augue at, euismod lorem. Praesent sit amet tempus est. Nam et neque mollis, pretium ante sed, aliquet enim. abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrs Integer vestibulum lacus euismod lectus placerat, ut commodo metus tempor. Vivamus sagittis mauris id fringilla mattis. Nam convallis accumsan nulla nec eleifend. Suspendisse lobortis iaculis magna vel convallis. Ut id metus posuere, ullamcorper sapien at, sodales massa. Aenean commodo quis dolor vitae convallis. Duis sed metus non nisl commodo porttitor a sed augue. Vestibulum non risus bibendum, aliquam nulla vel, imperdiet sem. Suspendisse mattis eu lorem ac accumsan. Donec eget pulvinar libero. Nam cursus gravida gravida. Proin interdum elementum euismod. Nunc nec viverra ipsum. Nunc ultrices purus nisi, sed scelerisque elit suscipit ut. "
response.write "<b>string1:</b><br>"&string1&"<BR><br>"
response.write "<b>string2:</b><br>"&replace(fixstring(string1),vbcrlf,"<br>")
%>
0
source

The best solution I found is to use this code:

ObjMail.HtmlBody="text of your message"
'*** NOTE: the following instruction has to be placed HERE, just after the HtmlBody
ObjMail.HtmlBodyPart.ContentTransferEncoding = "quoted-printable"

It seems to work flawlessly!

0
source

This happens when a string contains more than 750 characters. Try using vbNewLine or Chr (10) to split lines in html.

Example:

Set rs = conn.execute(txtsql)

html = ""
html = html & "<h1>Hi " & rs("Engineer_Name") & "</h1>" & vbNewLine
html = html & "<div class=''><table class='maintable'>" & vbNewLine
html = html &   "<thead>"
html = html &       "<tr>"
html = html &           "<th>ID</th>"
html = html &           "<th>Title</th>"
html = html &       "</tr>"
html = html &   "</thead>" & vbNewLine
html = html &   "<tbody>" & vbNewLine

Do Until rs.EOF
    html = html &       "<tr>"
    html = html &           "<td>" & rs("ID_Calendar") & "</td>"
    html = html &           "<td>" & rs("Title") & "</td>"
    html = html &       "</tr>" & vbNewLine
    rs.movenext
Loop

html = html &   "</tbody>" & vbNewLine
html = html & "</table></div>"
0
source

Source: https://habr.com/ru/post/1730881/


All Articles