用jmail4.3收郵件,一般的郵件都沒有問題,在收取嵌入html(包括圖片,文字等)頁面的郵件時,標題會出現(xiàn)亂碼,亂碼如下所示:
鏂伴椈蹇€?--絎洓鏈燂紝2007騫?鏈?(璇峰悜MSTC鍚屼簨杞彂錛Fw: MSTC鏂伴椈蹇€?--絎洓鏈燂紝2007騫?鏈?(
請問如何解決?
借用csdn里面一個大俠寫的,特別好用,肯定不會亂碼
- VBScript code
Function Jmail(mailTo,mailTopic,mailBody,mailCharset,mailContentType)
'入口參數(shù):
' mailTo 收件人email地址
' mailTopic 郵件主題
' mailBody 郵件正文(內(nèi)容)
' mailCharset 郵件字符集,例如GB2312或US-ASCII
' mailContentType 郵件正文格式,例如text/plain或text/html
'返回值:
' 字符串,發(fā)送成功后返回OK,不成功返回錯誤信息
'使用方法:
' 1)設(shè)置好常量,即以Const開頭的變量
' 2)使用類似如下代碼發(fā)信
'Dim SendStat
'SendStat = Jmail("aa@163.com","測試Jmail","這是一封<br/>測試信!","GB2312","text/html")
'Response.Write SendStat
'***************根據(jù)需要設(shè)置常量開始*****************
Dim ConstFromNameCn,ConstFromNameEn,ConstFrom,ConstMailDomain,ConstMailServerUserName,ConstMailServerPassword
ConstFromNameCn = "張三"'發(fā)信人中文姓名(發(fā)中文郵件的時候使用),例如'張三'
ConstFromNameEn = "zhangsan"'發(fā)信人英文姓名(發(fā)英文郵件的時候使用),例如'zhangsan'
ConstFrom = ""'發(fā)信人郵件地址,例如'zhangsan@163.com'
ConstMailDomain = ""'smtp服務(wù)器地址,例如smtp.163.com
ConstMailServerUserName = ""'smtp服務(wù)器的信箱登陸名,例如'zhangsan'。注意要與發(fā)信人郵件地址一致!
ConstMailServerPassword = ""'smtp服務(wù)器的信箱登陸密碼
'***************根據(jù)需要設(shè)置常量結(jié)束*****************
'-----------------------------以下內(nèi)容無需改動------------------------------
On Error Resume Next
Dim myJmail
Set myJmail = Server.CreateObject("JMail.Message")
myJmail.Logging = False'記錄日志
myJmail.ISOEncodeHeaders = False'郵件頭不使用ISO-8859-1編碼
myJmail.ContentTransferEncoding = "base64"'郵件編碼設(shè)為base64
myJmail.AddHeader "Priority","3"'添加郵件頭,不要改動!
myJmail.AddHeader "MSMail-Priority","Normal"'添加郵件頭,不要改動!
myJmail.AddHeader "Mailer","Microsoft Outlook Express 6.00.2800.1437"'添加郵件頭,不要改動!
myJmail.AddHeader "MimeOLE","Produced By Microsoft MimeOLE V6.00.2800.1441"'添加郵件頭,不要改動!
myJmail.Charset = mailCharset
myJmail.ContentType = mailContentType
If UCase(mailCharset) = "GB2312" Then
myJmail.FromName = ConstFromNameCn
Else
myJmail.FromName = ConstFromNameEn
End If
myJmail.From = ConstFrom
myJmail.Subject = mailTopic
myJmail.Body = mailBody
myJmail.AddRecipient mailTo
myJmail.MailDomain = ConstMailDomain
myJmail.MailServerUserName = ConstMailServerUserName
myJmail.MailServerPassword = ConstMailServerPassword
myJmail.Send ConstMailDomain
myJmail.Close
Set myJmail=nothing
If Err Then
Jmail=Err.Description
Err.Clear
Else
Jmail="OK"
End If
On Error Goto 0
End Function
如果需要發(fā)送,直接調(diào)用這個就可以了,非常好用 csdn大俠出品,具體是誰忘記了。。
該文章在 2011/12/23 9:14:14 編輯過