加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > asp.Net > 正文

asp-classic – CDO电子邮件主题特殊字符错误

发布时间:2020-12-16 06:26:46 所属栏目:asp.Net 来源:网络整理
导读:我在通过网站发送的电子邮件主题中遇到特殊字符时遇到问题. 例如,土耳其字符显示为; yurtd?±???±na?§?±k?±??kap?±s?±i?§ine-postaadresinizionaylay?±n. 我身体有同样的问题,但我设法通过构建一个函数来解决它.但我不能将它与主题一起使用,因为它不
我在通过网站发送的电子邮件主题中遇到特殊字符时遇到问题.
例如,土耳其字符显示为; yurtd?±???±na?§?±k?±??kap?±s?±i?§ine-postaadresinizionaylay?±n.
我身体有同样的问题,但我设法通过构建一个函数来解决它.但我不能将它与主题一起使用,因为它不是 HTML.
我该怎么做才能解决这个问题?

lngSignupTitle      = "*strWebsiteTitle* i?in e-posta adresinizi onaylay?n"
lngSignupBody       = "<!doctype html><!--[if lt IE 7]> <html class='no-js lt-ie9 lt-ie8 lt-ie7' lang='en'> <![endif]--><!--[if IE 7]> <html class='no-js lt-ie9 lt-ie8' lang='en'> <![endif]--><!--[if IE 8]> <html class='no-js lt-ie9' lang='en'> <![endif]--><!--[if gt IE 8]><!--> <html class='no-js' lang='en'> <!--<![endif]--><head><title></title><meta http-equiv='Content-Type' content='text/html; charset=utf-8'><style type='text/css'>/* Mobile-specific Styles */@media only screen and (max-device-width: 480px) { table[class=w0],td[class=w0] { width: 0 !important; }table[class=w10],td[class=w10],img[class=w10] { width:10px !important; }table[class=w15],td[class=w15],img[class=w15] { width:5px !important; }table[class=w30],td[class=w30],img[class=w30] { width:10px !important; }table[class=w60],td[class=w60],img[class=w60] { width:10px !important; }table[class=w125],td[class=w125],img[class=w125] { width:80px !important; }table[class=w130],td[class=w130],img[class=w130] { width:55px !important; }table[class=w140],td[class=w140],img[class=w140] { width:90px !important; }table[class=w160],td[class=w160],img[class=w160] { width:180px !important; }table[class=w170],td[class=w170],img[class=w170] { width:100px !important; }table[class=w180],td[class=w180],img[class=w180] { width:80px !important; }table[class=w195],td[class=w195],img[class=w195] { width:80px !important; }table[class=w220],td[class=w220],img[class=w220] { width:80px !important; }table[class=w240],td[class=w240],img[class=w240] { width:180px !important; }table[class=w255],td[class=w255],img[class=w255] { width:185px !important; }table[class=w275],td[class=w275],img[class=w275] { width:135px !important; }table[class=w280],td[class=w280],img[class=w280] { width:135px !important; }table[class=w300],td[class=w300],img[class=w300] { width:140px !important; }table[class=w325],td[class=w325],img[class=w325] { width:95px !important; }table[class=w360],td[class=w360],img[class=w360] { width:140px !important; }table[class=w410],td[class=w410],img[class=w410] { width:180px !important; }table[class=w470],td[class=w470],img[class=w470] { width:200px !important; }table[class=w580],td[class=w580],img[class=w580] { width:280px !important; }table[class=w640],td[class=w640],img[class=w640] { width:300px !important; }table[class*=hide],td[class*=hide],img[class*=hide],p[class*=hide],span[class*=hide] { display:none !important; }table[class=h0],td[class=h0] { height: 0 !important; }p[class=footer-content-left] { text-align: center !important; }#headline p { font-size: 30px !important; }.article-content,#left-sidebar{ -webkit-text-size-adjust: 90% !important; -ms-text-size-adjust: 90% !important; }.header-content,.footer-content-left {-webkit-text-size-adjust: 80% !important; -ms-text-size-adjust: 80% !important;}img { height: auto; line-height: 100%;} } /* Client-specific Styles */#outlook a { padding: 0; }/* Force Outlook to provide a 'view in browser' button. */body { width: 100% !important; }.ReadMsgBody { width: 100%; }.ExternalClass { width: 100%; display:block !important; } /* Force Hotmail to display emails at full width *//* Reset Styles *//* Add 100px so mobile switch bar doesn't cover street address. */body { background-color: #FFED90; margin: 0; padding: 0; }img { outline: none; text-decoration: none; display: block;}br,strong br,b br,em br,i br { line-height:100%; }h1,h2,h3,h4,h5,h6 { line-height: 100% !important; -webkit-font-smoothing: antialiased; }h1 a,h2 a,h3 a,h4 a,h5 a,h6 a { color: blue !important; }h1 a:active,h2 a:active,h3 a:active,h4 a:active,h5 a:active,h6 a:active {color: red !important; }/* Preferably not the same color as the normal header link color. There is limited support for psuedo classes in email clients,this was added just for good measure. */h1 a:visited,h2 a:visited,h3 a:visited,h4 a:visited,h5 a:visited,h6 a:visited { color: purple !important; }/* Preferably not the same color as the normal header link color. There is limited support for psuedo classes in email clients,this was added just for good measure. */ table td,table tr { border-collapse: collapse; }.yshortcuts,.yshortcuts a,.yshortcuts a:link,.yshortcuts a:visited,.yshortcuts a:hover,.yshortcuts a span {color: black; text-decoration: none !important; border-bottom: none !important; background: none !important;}/* Body text color for the New Yahoo. This example sets the font of Yahoo's Shortcuts to black. *//* This most probably won't work in all email clients. Don't include <code _tmplitem='664' > blocks in email. */code { white-space: normal; word-break: break-all;}#background-table { background-color: #FFED90; }/* Webkit Elements */#top-bar { border-radius:6px 6px 0px 0px; -moz-border-radius: 6px 6px 0px 0px; -webkit-border-radius:6px 6px 0px 0px; -webkit-font-smoothing: antialiased; background-color: #000000; color: #FFFFFF; }#top-bar a { font-weight: bold; color: #A8D46F; text-decoration: none;}#footer { border-radius:0px 0px 6px 6px; -moz-border-radius: 0px 0px 6px 6px; -webkit-border-radius:0px 0px 6px 6px; -webkit-font-smoothing: antialiased; }/* Fonts and Content */body,td { font-family: 'Helvetica Neue',Arial,Helvetica,Geneva,sans-serif; }.header-content,.footer-content-left,.footer-content-right { -webkit-text-size-adjust: none; -ms-text-size-adjust: none; }/* Prevent Webkit and Windows Mobile platforms from changing default font sizes on header and footer. */.header-content { font-size: 12px; color: #FFFFFF; }.header-content a { font-weight: bold; color: #A8D46F; text-decoration: none; }#headline p { color: #444444; font-family: 'Helvetica Neue',sans-serif; font-size: 36px; text-align: center; margin-top:0px; margin-bottom:30px; }#headline p a { color: #444444; text-decoration: none; }.article-title { font-size: 18px; line-height:24px; color: #341139; font-weight:bold; margin-top:0px; margin-bottom:18px; font-family: 'Helvetica Neue',sans-serif; }.article-title a { color: #341139; text-decoration: none; }.article-title.with-meta {margin-bottom: 0;}.article-meta { font-size: 13px; line-height: 20px; color: #ccc; font-weight: bold; margin-top: 0;}.article-content { font-size: 13px; line-height: 18px; color: #3C3251; margin-top: 0px; margin-bottom: 18px; font-family: 'Helvetica Neue',sans-serif; }.article-content a { color: #359668; font-weight:bold; text-decoration:none; }.article-content img { max-width: 100% }.article-content ol,.article-content ul { margin-top:0px; margin-bottom:18px; margin-left:19px; padding:0; }.article-content li { font-size: 13px; line-height: 18px; color: #3C3251; }.article-content li a { color: #359668; text-decoration:underline; }.article-content p {margin-bottom: 15px;}.footer-content-left { font-size: 12px; line-height: 15px; color: #FFFFFF; margin-top: 0px; margin-bottom: 15px; }.footer-content-left a { color: #A8D46F; font-weight: bold; text-decoration: none; }.footer-content-right { font-size: 11px; line-height: 16px; color: #FFFFFF; margin-top: 0px; margin-bottom: 15px; }.footer-content-right a { color: #A8D46F; font-weight: bold; text-decoration: none; }#footer { background-color: #000000; color: #FFFFFF; }#footer a { color: #A8D46F; text-decoration: none; font-weight: bold; }#permission-reminder { white-space: normal; }#street-address { color: #FFFFFF; white-space: normal; }</style><!--[if gte mso 9]><style _tmplitem='664' >.article-content ol,.article-content ul { margin: 0 0 0 24px; padding: 0; list-style-position: inside;}</style><![endif]--></head><body><table id='background-table' border='0' cellpadding='0' cellspacing='0' width='100%'><tbody><tr><td align='center' bgcolor='#FFED90'> <table class='w640' style='margin:0 10px;' border='0' cellpadding='0' cellspacing='0' width='640'> <tbody> <tr> <td class='w640' height='20' width='640'></td> </tr> <tr> <td id='header' class='w640' align='center' bgcolor='#359668' width='640'> <div style='text-align: left' align='left'> <a href='http://www.kampuster.com'> <img id='customHeaderImage' label='Header Image' editable='true' src='http://www.kampuster.com/images/inner_logo.png' class='w640' style='display: inline' align='top' border='0' width='147'> </a> </div> </td> </tr> <tr> <td class='w640' bgcolor='#FFFFFF' height='30' width='640'></td> </tr> <tr id='simple-content-row'><td class='w640' bgcolor='#FFFFFF' width='640'> <table class='w640' border='0' cellpadding='0' cellspacing='0' width='640'> <tbody><tr> <td class='w30' width='30'></td> <td class='w580' width='580'> <repeater> <layout label='Text only'> <table class='w580' border='0' cellpadding='0' cellspacing='0' width='580'> <tbody><tr> <td class='w580' width='580'> <p class='article-title' align='left'> <singleline label='Title'>lütfen *strWebsiteTitle* i?in e-posta adresinizi onaylay?n</singleline></p> <div class='article-content' align='left'> <multiline label='Description'> <p> Merhaba *strFirstName*,</p> <br /> <p>*strWebsiteTitle* üyeli?inizin aktif hale gelmesi i?in lütfen a?a??daki ba?lant?ya t?klay?n:</p> <p><a href='*strWebsiteURL*/inner.asp?Section=myaccount&SubSection=confirm&EmailAddress=*strEmailAddress*&Active_Code=*strActive_Code*'>*strWebsiteURL*/inner.asp?Section=myaccount&SubSection=confirm&amp;s=1&amp;EmailAddress=*strEmailAddress*&Active_Code=*strActive_Code*</p> <p>Te?ekkürler,<br />*strWebsiteTitle*</p> </multiline> </div> </td> </tr> <tr><td class='w580' height='10' width='580'></td></tr> </tbody></table> </layout> </repeater> </td> <td class='w30' width='30'></td> </tr> </tbody></table></td></tr> <tr><td class='w640' bgcolor='#FFFFFF' height='15' width='640'></td></tr> <tr> <td class='w640' width='640'> <table id='footer' class='w640' bgcolor='#000000' border='0' cellpadding='0' cellspacing='0' width='640'> <tbody><tr><td class='w30' width='30'></td><td class='w580 h0' height='30' width='360'></td><td class='w0' width='60'></td><td class='w0' width='160'></td><td class='w30' width='30'></td></tr> <tr> <td class='w30' width='30'></td> <td class='w580' valign='top' width='360'> <span class='hide'> <p id='permission-reminder' class='footer-content-left' align='left'> <span>*strWebsiteURL* üzerinden bu e-posta adresi ile kay?t i?leminde bulunuldu?u i?in bu mesaj? ald?n?z</span><br> <span>E?er bu i?lemi siz yapmadiysan?z,lütfen bizimle ileti?ime ge?in</span> <span>*strWebsiteEURL*</span> </p></span> </td> <td class='hide w0' width='60'></td> <td class='hide w0' valign='top' width='160'> <p id='street-address' class='footer-content-right' align='right'><span></span></p> </td> <td class='w30' width='30'></td> </tr> <tr><td class='w30' width='30'></td><td class='w580 h0' height='15' width='360'></td><td class='w0' width='60'></td><td class='w0' width='160'></td><td class='w30' width='30'></td></tr></tbody> </table></td> </tr> <tr> <td class='w640' height='60' width='640'></td> </tr> </tbody></table> </td></tr></tbody></table></body></html>"


        MailSubject = strMessageTitle
        MailBody = strMessageBody

        Set objEmail = Server.CreateObject("CDO.Message")
        objEmail.To     = MailTo
        objEmail.From       = MailFrom
        objEmail.Subject    = MailSubject
        objEmail.HTMLBody   = MailBody
        objEmail.BodyPart.Charset = "utf-8" 
        objEmail.HTMLBodyPart.Charset = "utf-8"

Function trchar(rtt)
    ii  = Replace(rtt,"?","&#305;")
    rtt = ii 
    OO  = Replace(rtt,"?","&#214;")
    rtt = OO 
    Oo  = Replace(rtt,"?","&#246;")
    rtt = Oo 
    UU  = Replace(rtt,"ü","&#220;")
    rtt = UU 
    Uu  = Replace(rtt,"ü","&#252;")
    rtt = Uu 
    CC  = Replace(rtt,"?","&#199;")
    rtt = CC 
    Cc  = Replace(rtt,"?","&#231;")
    rtt = Cc 
    GG  = Replace(rtt,"?","&#286;")
    rtt = GG 
    Gg  = Replace(rtt,"?","&#287;")
    rtt = Gg 
    SS  = Replace(rtt,"?","&#350;")
    rtt = SS 
    Ss  = Replace(rtt,"?","&#351;")
    trchar = Ss 
End Function

解决方法

这对我有用:

<%
Response.Codepage = 65001 
Response.Charset = "utf-8" 

MailTo = ""
MailFrom = ""
MailSubject = "Evinizdeymi?im"
MailBody = "<b>Evinizdeymi?im</b>"

Set objEmail = Server.CreateObject("CDO.Message")
Set objConf = Server.CreateObject("CDO.Configuration") 

With objConf.Fields
    .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
    .Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = 1
    .item("http://schemas.microsoft.com/cdo/configuration/sendusername") = ""
    .item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = ""
    .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver")  = ""

    .Update 
End With

Set objEmail.Configuration = objConf

objEmail.BodyPart.Charset = "utf-8" 

objEmail.To         = MailTo
objEmail.From       = MailFrom
objEmail.Subject    = MailSubject
objEmail.HTMLBody   = MailBody
objEmail.HTMLBodyPart.Charset = "utf-8"

objEmail.send

set objEmail = nothing
%>

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读