佳木斯湛栽影视文化发展公司

主頁 > 知識庫 > asp空間判斷jmail組件是否安裝或支持的代碼

asp空間判斷jmail組件是否安裝或支持的代碼

熱門標(biāo)簽:團(tuán)購網(wǎng)站 阿里云 服務(wù)器配置 Linux服務(wù)器 Mysql連接數(shù)設(shè)置 電子圍欄 銀行業(yè)務(wù) 科大訊飛語音識別系統(tǒng)
首先,必須有錯(cuò)誤繼續(xù)進(jìn)行的聲明On Error Resume Next
然后嘗試簡歷jmail實(shí)例:
Dim JMail
Set JMail=Server.CreateObject("JMail.Message")

對實(shí)例做出判斷,如果組件沒有安裝成功,則沒有創(chuàng)建實(shí)例:
If JMail Is Nothing Then
Response.Write "不支持"
Else
Response.Write "支持"
End If

其他組件同樣處理,非常簡單了。
最好在global文件中處理,里面使用的時(shí)候不用那么麻煩了。
最好的方法把郵件生成放到一個(gè)表里,然后再說發(fā)送的事情。

復(fù)制代碼 代碼如下:

Function IsObjInstalled(strClassString)
On Error Resume Next
IsObjInstalled = False
Err = 0
Dim xTestObj
Set xTestObj = Server.CreateObject(strClassString)
If 0 = Err Then IsObjInstalled = True
Set xTestObj = Nothing
Err = 0
End Function

判斷代碼:
if IsObjInstalled("JMail.Message")=True then{
if IsObjInstalled("JMail.Message") =True then
SendStat = Jmail("***@jb51.net","來自網(wǎng)上的客戶留言","html>head>meta http-equiv=""Content-Type"" content=""text/html; charset=gb2312"">title>網(wǎng)站用戶留言/title>/head>body>留言人:"txtname"br>性別:"xingbie"br>咨詢網(wǎng)站:"txtweb"br>聯(lián)系方式:"txttel"br>留言內(nèi)容:"content"br>IP地址:"ipaddress"br>留言時(shí)間:"now()"br>br>本郵件由系統(tǒng)自動(dòng)發(fā)送,無須回復(fù)!--腳本之家www.jb51.net-->br>br>/body>/html>","GB2312","text/html")
end if
}

jmail發(fā)信函數(shù)
復(fù)制代碼 代碼如下:

' ============================================
' jmail發(fā)送郵件
' ============================================
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,不成功返回錯(cuò)誤信息
'使用方法:
'    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 = "彩票網(wǎng)"'發(fā)信人中文姓名(發(fā)中文郵件的時(shí)候使用),例如‘張三'
ConstFromNameEn = "bc5"'發(fā)信人英文姓名(發(fā)英文郵件的時(shí)候使用),例如‘zhangsan'
ConstFrom = "jb51@163.com"'發(fā)信人郵件地址,例如‘zhangsan@163.com'
ConstMailDomain = "smtp.163.com"'smtp服務(wù)器地址,例如smtp.163.com
ConstMailServerUserName = "jb51@163.com"'smtp服務(wù)器的信箱登陸名,例如‘zhangsan'。注意要與發(fā)信人郵件地址一致!
ConstMailServerPassword = "www.jb51.net"'smtp服務(wù)器的信箱登陸密碼
'***************根據(jù)需要設(shè)置常量結(jié)束*****************
'-----------------------------以下內(nèi)容無需改動(dòng)------------------------------
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"'添加郵件頭,不要改動(dòng)!
myJmail.AddHeader "MSMail-Priority","Normal"'添加郵件頭,不要改動(dòng)!
myJmail.AddHeader "Mailer","Microsoft Outlook Express 6.00.2800.1437"'添加郵件頭,不要改動(dòng)!
myJmail.AddHeader "MimeOLE","Produced By Microsoft MimeOLE V6.00.2800.1441"'添加郵件頭,不要改動(dòng)!
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

您可能感興趣的文章:
  • asp中判斷服務(wù)器是否安裝了某種組件的函數(shù)
  • Win2003安裝并注冊jmail組件
  • Jmail 圖文安裝教程 asp在線發(fā)送郵件組件
  • 解決JMail無法安裝的方法(帳戶名與安全標(biāo)識間無任何映射完成)
  • asp jmail發(fā)郵件 詳細(xì)解析
  • asp通過JMAIL實(shí)現(xiàn)通用發(fā)送函數(shù)
  • 使用Jmail及Winwebmail發(fā)信時(shí)系統(tǒng)記錄中的錯(cuò)誤:502 Error: command ...
  • 安裝jmail 出現(xiàn)The message was undeliverable. All servers failed to receive the message的解決方法
  • Jmail組件發(fā)送郵件之絕對能用的函數(shù)
  • Jmail發(fā)郵件的例子
  • ASP用JMail、CDO發(fā)送郵件

標(biāo)簽:衡水 大理 廣元 蚌埠 江蘇 衢州 萍鄉(xiāng) 棗莊

巨人網(wǎng)絡(luò)通訊聲明:本文標(biāo)題《asp空間判斷jmail組件是否安裝或支持的代碼》,本文關(guān)鍵詞  ;如發(fā)現(xiàn)本文內(nèi)容存在版權(quán)問題,煩請?zhí)峁┫嚓P(guān)信息告之我們,我們將及時(shí)溝通與處理。本站內(nèi)容系統(tǒng)采集于網(wǎng)絡(luò),涉及言論、版權(quán)與本站無關(guān)。
  • 相關(guān)文章
  • 收縮
    • 微信客服
    • 微信二維碼
    • 電話咨詢

    • 400-1100-266
    昌都县| 沈阳市| 周至县| 卓资县| 萍乡市| 军事| 安岳县| 仁寿县| 定远县| 精河县| 青州市| 黔西| 青阳县| 安龙县| 江源县| 上杭县| 青州市| 荆州市| 志丹县| 台安县| 莆田市| 兴城市| 绥化市| 赤水市| 固始县| 大埔县| 榕江县| 德阳市| 内江市| 葫芦岛市| 抚宁县| 临武县| 台前县| 抚松县| 泸水县| 田东县| 阜康市| 卢龙县| 福州市| 舞阳县| 夏津县|