📄 sendmail.asp
字号:
<!--#include file="articleconn.asp"-->
<!--#include file="security.asp"-->
<html>
<head>
<meta http-equiv="Content-Language" content="zh-cn">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<link rel="stylesheet" type="text/css" href="css/style.css">
<title></title>
</head>
<style type=text/css>
body { background:#799AE1; margin:0px; font:9pt 宋体; }
table { border:0px; }
td { font:normal 12px 宋体; }
img { vertical-align:bottom; border:0px; }
a { font:normal 12px 宋体; color:#000000; text-decoration:none; }
a:hover { color:#428EFF;text-decoration:underline; }
.sec_menu { border-left:1px solid white; border-right:1px solid white; border-bottom:1px solid white; overflow:hidden; background:#D6DFF7; }
.menu_title { }
.menu_title span { position:relative; top:2px; left:8px; color:#215DC6; font-weight:bold; }
.menu_title2 { }
.menu_title2 span { position:relative; top:2px; left:8px; color:#428EFF; font-weight:bold; }
</style>
<body >
<form name="sendmail" action="?action=send" method="post">
<div align="center">
<center>
<table border="0" cellspacing="0" cellpadding="4" width="450" bgcolor="#797161" style="border-collapse: collapse" bordercolor="#111111">
<tr bgcolor="#ffcf00">
<td height="23" colspan="2" align="center" bgcolor="#F5F5F5">发 送 邮 件</td>
</tr>
<tr bgcolor="#f6f6f6">
<td height="25" width="20%" bgcolor="#FFFFFF" align="right" valign="middle">
发信人地址:</td>
<td height="25" width="80%" bgcolor="#FFFFFF">
<input type="text" name="frommail" size="20" value="mayi@cn-mayi.com"> </td>
</tr>
<tr bgcolor="#f6f6f6">
<td height="25" width="20%" bgcolor="#FFFFFF" align="right" valign="middle">
收信人地址:</td>
<td height="25" width="80%" bgcolor="#FFFFFF">
<input type="text" name="tomail" size="20" value="<%=request("email")%>">
(如果为空,则向所有会员群发!) </td>
</tr>
<tr bgcolor="#f6f6f6">
<td height="25" width="20%" bgcolor="#FFFFFF" align="right" valign="middle">
信件标题:</td>
<td height="25" width="80%" bgcolor="#FFFFFF">
<input type="text" name="mailsubject" size="49" value="蚂蚁影院通知"> </td>
</tr>
<tr bgcolor="#f6f6f6">
<td height="25" width="20%" bgcolor="#FFFFFF" align="right" valign="top">
信件内容:</td>
<td height="25" width="80%" bgcolor="#FFFFFF">
<textarea name="mailbody" cols="48" rows="8"></textarea> <br>
</td>
</tr>
<tr bgcolor="#f6f6f6">
<td height="10" colspan="2" align="center" bgcolor="#FFFFFF">
<input type="submit" name="Submit" value="发送">
<input type="reset" name="Submit" value="取消"> </td>
</tr>
</table>
</center>
</div>
</form>
</body>
<%
if request("action") = "send" then
frommail = Trim(Request.Form("frommail"))
tomail = Trim(Request.Form("tomail"))
mailsubject = Trim(Request.Form("mailsubject"))
mailbody = Trim(Request.Form("mailbody"))
smtpserver ="邮局IP"
smtpuser ="mayi@cn-mayi.com"'你的EMALI帐号
smtppwd ="passowrd"'你的EMAIL密码
if tomail<>"" then
' 创建jmail对象:
Set JMail = Server.CreateObject("JMail.Message")
'身分验证
JMail.MailServerUserName = smtpuser
JMail.MailServerPassword = smtppwd
JMail.Charset ="gb2312"
JMail.ContentType = "text/html"
JMail.from = frommail
JMail.AddRecipient(""&tomail&"")
JMail.Subject = mailsubject
JMail.Body = mailbody
JMail.Priority = 3
JMail.Send(smtpserver)
JMail.Close()
Set JMail=nothing
else
' 创建jmail对象:
Set JMail = Server.CreateObject("JMail.Message")
'身分验证
JMail.MailServerUserName = smtpuser
JMail.MailServerPassword = smtppwd
JMail.Charset ="gb2312"
JMail.ContentType = "text/html"
JMail.from = frommail
sql="select email from users"
set rs=conn.execute(sql)
Response.Write("正在邮件群发.................." )
do while not rs.eof
JMail.AddRecipient(""&rs("email")&"")
RS.MoveNext
Loop
rs.close
JMail.Subject = mailsubject
JMail.Body = mailbody
JMail.Priority = 3
JMail.Send(smtpserver)
JMail.Close()
Set JMail=nothing
end if
Response.Write "<script>alert(""发送成功"");location.href=""sendmail.asp"";</script>"
Response.End
end if
%>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -