⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mail_sendto.asp

📁 使用Asp+Access+FSO+Jmail+Servu开发
💻 ASP
字号:
<%@language=vbscript codepage=936 %>
<% Server.ScriptTimeout = 1000 %>
<!--#include file="admin.asp"-->

<%
if not IsObjInstalled("jmail.message") Then
	Response.Write "<script>alert('您的服务器不支持Jmail,不能使用邮件群发功能!');location.href='javascript:history.back()'</script>"
	Response.End
end if 
set rs=server.createobject("adodb.recordset") 
sql="select * from config" 
rs.open sql,conn,1,1 
smtpserver=rs("smtpserver")
smtpuser=rs("smtpname") 
smtppwd=rs("smtppass") 
smtpemail=rs("siteemail")
toemail=Request.Form("toemail")
sendname=Request.Form("name")
email=Request.Form("email")
subject=Request.Form("subject")
body=Request.Form("body")
if sendname="" or email="" or subject="" or body="" then
response.write "<script language='javascript'>alert('您的邮件信息没有填写完整!');location.href='javascript:history.back()'</script>"
response.end
end if
if toemail<>"" then '如果收件人地址不为空,则单一发送
mailbody=mailbody &"<style>A:visited {	TEXT-DECORATION: none	}"
	mailbody=mailbody &"A:active  {	TEXT-DECORATION: none	}"
	mailbody=mailbody &"A:hover   {	TEXT-DECORATION: underline	}"
	mailbody=mailbody &"A:link 	  {	text-decoration: none;}"
	mailbody=mailbody &"BODY   {	FONT-FAMILY: 宋体; FONT-SIZE: 9pt;}"
	mailbody=mailbody &"TD	   {	FONT-FAMILY: 宋体; FONT-SIZE: 9pt	}</style>"
	mailbody=mailbody &"<TABLE border=0 width='95%' align=center><TBODY><TR><TD>"
	mailbody=mailbody &"您好!我是"&sendname&"<br><br>"
	mailbody=mailbody &""&body&"<br>"
	mailbody=mailbody &"*************************************************************************************"
	mailbody=mailbody &"<br>此邮件由<a href=http://www.9cool.net target=_blank>九酷网络(www.9cool.net)</a>邮件群发系统发送,请勿直接回复此邮件!<br>"
	mailbody=mailbody &"该邮件的发件人为"&sendname&"&nbsp;&nbsp;发件人邮箱为"&email&"<br>"
	mailbody=mailbody &"如果需要回复,请发邮件至"&email&",切记!本站对邮件的内容不负任何法律责任!<br>"
	mailbody=mailbody &"*************************************************************************************"	
	mailbody=mailbody &"</TD></TR></TBODY></TABLE>"
set jmail= server.CreateObject ("jmail.message")
jmail.Silent = true
jmail.Charset = "gb2312"
JMail.ContentType = "text/html"
jmail.From = smtpemail
jmail.FromName = sendname
jmail.ReplyTo = email
jmail.Subject = subject
jmail.AddRecipient toemail
jmail.Body = mailbody 
jmail.MailServerUserName = smtpuser
jmail.MailServerPassWord = smtppwd
isgo = jmail.Send(smtpserver)
if isgo then
response.write "<script language='javascript'>alert('向"&toemail&"发送的邮件成功!');location.href='mail_send.asp'</script>"
else
response.write "<script language='javascript'>alert('向"&toemail&"发送的邮件失败,请检查发送邮件参数设置!');location.href='mail_send.asp'</script>"
end if
end if
if toemail="" then '如果收件人地址为空,邮件群发
set rsmail=server.createobject("adodb.recordset") 
sqlmail= "select * from [user]" 
rsmail.open sqlmail,conn,1,1 
for i=1 to rsmail.recordcount
set jmail= server.CreateObject ("jmail.message")
jmail.Silent = true
jmail.Charset = "gb2312"
JMail.ContentType = "text/html"
jmail.From = smtpemail
jmail.FromName = sendname
jmail.ReplyTo = email
jmail.Subject = subject
jmail.AddRecipient rsmail("email")
jmail.Body = mailbody 
jmail.MailServerUserName = smtpuser
jmail.MailServerPassWord = smtppwd
isgo = jmail.Send(smtpserver)
rsmail.movenext
next
end if
if isgo then
response.write "<script language='javascript'>alert('邮件群发送成功,共发送"&rsmail.recordcount&"封邮件!');location.href='mail_send.asp'</script>"
else
response.write "<script language='javascript'>alert('邮件群发失败,请检查发送邮件参数设置!');location.href='mail_send.asp'</script>"
end if
jmail.Close
set jmail = nothing
%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -