Asp-Email組件的實際應用
來源:互聯網
上載者:User
sub sendMail(a_intID , a_strEmail)
const c_strMailServer = "smtp.163.net"
dim objConn,objRs,strSql
dim strContent,strBody,strSubject,objEmail
strBody = "<html><head>"
strBody = strBody + "<meta HTTP-EQUIV=Content-Type content=text/html; charset=gb2312>"
strBody = strBody + "</head><body bgColor=#d2b48c>"
strBody = strBody + "<a href='http://www.china-168.net/center/default.asp>" + "<img src=banner.gif border=0>" + "</a>"
strBody = strBody + "<h3 style='FONT-SIZE: 15px'>" + "請您確認" + "</h>" + vbcrlf
strBody = strBody + "<p style='FONT-SIZE: 13px'>" + "您好<a href=mailto:"&a_strEmail&">"&a_strEmail&"</a>" + "</td>" + vbcrlf
strBody = strBody + "<p style='FONT-SIZE: 13px'>" + "歡迎您訂閱萬裡資訊網郵件清單" +"</td>"
strBody = strBody + "<p style='FONT-SIZE: 13px'>" + "為了防止出現訂閱錯誤,請您點擊以下連結進行確認。謝謝!" + "</td>"
strBody = strBody + "<p style='FONT-SIZE: 13px'>" + "<a href=""http://www.china-168.net/EmailList/affirm.asp?Mode=MailList&content="&a_strEmail&""">" + "請點擊這裡,進行訂閱確認" + "</a>"
strBody = strBody + "<p style='FONT-SIZE: 13px'><a href=http://www.china-168.net target='_blank'>" + vbcrlf
strBody = strBody + "<img src=logo.gif"
strBody = strBody + " alt='更多資訊盡在萬裡資訊網'></a><br>"
strBody = strBody + "<p style='FONT-SIZE: 13px'>" + "歡迎再次光臨萬裡資訊網!" + "</td>"
strBody = strBody + "</body></html>"
'發送email
on error resume next
set objEmail = server.CreateObject("Persits.MailSender")
objEmail.Host = c_strMailServer
objEmail.From = "jiabaoxu@163.net"
objEmail.FromName = "china-168.net"
objEmail.AddAddress a_strEmail
objEmail.Subject = "訂閱確認"
objEmail.IsHTML = true
objEmail.CharSet = "gb2312"
objEmail.Body = strBody
objEmail.Send
'檢察錯誤
if Err.number = 0 then '如果成功
Response.Write ("<p align=center class=cn>為確保使用者不被騷擾,我們將發出確認信,請訪問信中的URL以確認登記</td>")
else '如果失敗則顯示出錯原因
Response.Write ("<p align=center class=cn>郵件發送出錯,錯誤原因:<br>")
Response.Write ("<font color=red>"&Err.Description&"</font></td>")
end if
'清場
set objEmail = nothing
end sub
使用該過程:
<%
.....
RTSEmail GuestMailID,""&email&""
.....
%>