asp空间判断jmail组件是否安装或支持的代码(2)


ConstFromNameEn = "bc5"'发信人英文姓名(发英文邮件的时候使用),例如‘zhangsan'
ConstFrom = "jb51@163.com"'发信人邮件地址,例如‘zhangsan@163.com'
ConstMailDomain = "smtp.163.com"'smtp服务器地址,例如smtp.163.com
ConstMailServerUserName = "jb51@163.com"'smtp服务器的信箱登陆名,例如‘zhangsan'。注意要与发信人邮件地址一致!
ConstMailServerPassword = "www.jb51.net"'smtp服务器的信箱登陆密码
'***************根据需要设置常量结束*****************
'-----------------------------以下内容无需改动------------------------------
On Error Resume Next
Dim myJmail
Set myJmail = Server.CreateObject("JMail.Message")
myJmail.Logging = False'记录日志
myJmail.ISOEncodeHeaders = False'邮件头不使用ISO-8859-1编码
myJmail.ContentTransferEncoding = "base64"'邮件编码设为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