asp使用jmail4.3的模塊
發(fā)表時(shí)間:2024-01-31 來源:明輝站整理相關(guān)軟件相關(guān)文章人氣:
[摘要]把程序放到一個(gè)文件中,然后包含再call就可以了。(JMAIL4.3)<%'警告函數(shù)sub w_msg(message,w_to,w_link)'message是你要彈出的警告信息,w_to=1表示自動(dòng)后退一頁,當(dāng)w_to<>1時(shí)w_link表示要跳轉(zhuǎn)的頁面if ...
把程序放到一個(gè)文件中,然后包含再call就可以了。(JMAIL4.3)
<%'警告函數(shù)
sub w_msg(message,w_to,w_link)
'message是你要彈出的警告信息,w_to=1表示自動(dòng)后退一頁,當(dāng)w_to<>1時(shí)w_link表示要跳轉(zhuǎn)的頁面
if w_to="1" then
%>
<script language="javascript">
<!--
function Index(){ window.alert('<%=message%>');history.back(-1)}
Index();
-->
</script>
<%else%>
<script language="javascript">
<!--
function Index(){ window.alert('<%=message%>');window.location="<%=w_link%>"}
Index();
-->
</script>
<%end if
end sub%>
<%
sub sendmail(mailtitle,mailtext,mailaddress,mailcc,mailbcc,attachment,mailserver)
if mailtitle="" then
mailtitle="系統(tǒng)測(cè)試郵件"
end if
if mailtext="" then
mailtext="Just a test"
end if
if mailaddress="" then
call w_msg("郵件地址不能為空","1","")
end if
if mailserver="" then
mailserver="smtp.163.com"
end if
set msg=server.createobject("JMail.Message")
msg.silent = true
msg.logging = true
msg.Charset="GB2312"
msg.ContentType = "text/html"
msg.MailServerUserName="yourusername"
msg.MailServerPassword="yourpassword"
msg.From="youremail"
msg.FromName="dorryyang"
mailaddress_s=split(mailaddress,",") ' 郵件地址用,格開
for i=0 to ubound(mailaddress_s)
msg.AddRecipient trim(mailaddress_s(i))
next
if mailcc<>"" then
mailcc_s=split(mailcc,",")
for i=0 to ubound(mailcc_s)
msg.AddRecipientCC trim(mailcc_s(i))
next
end if
if mailbcc<>"" then
mailbcc_s=split(mailbcc,",")
for i=0 to ubound(mailbcc_s)
msg.AddRecipientBCC trim(mailbcc_s(i))
next
end if
if attachment<>"" then
msg.AddAttachment(attachment) 'attachment寫附件地址
end if
msg.Subject=mailtitle
msg.HTMLBody=mailtext
msg.Send(mailserver)
msg.close
set msg=nothing
call w_msg("發(fā)送成功","1","")
end sub
%>