sendmail.asp
资源名称:qnmov30.rar [点击查看]
上传用户:qyswxdl
上传日期:2013-06-01
资源大小:1373k
文件大小:4k
源码类别:
家庭/个人应用
开发平台:
ASP/ASPX
- <!--#include file="../checkpost.asp"-->
- <!--#include file="articleconn.asp"-->
- <!--#include file="security.asp"-->
- <%if session("flag")>3 then
- response.write "<br><p align=center>您的操作权限不够!</p>"
- response.end
- end if
- %>
- <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 href="inc/Admin_STYLE.CSS" rel="stylesheet" type="text/css">
- </head>
- <title></title>
- <body >
- <form name="sendmail" action="?action=send" method="post">
- <div align="center">
- <center>
- <table width="474" border="0" align="center" cellpadding="4" cellspacing="1" class="border" style="border-collapse: collapse">
- <tr bgcolor="#429AEF">
- <td height="23" colspan="2" align="center" ><strong><font color="#FFFFFF">发
- 送 邮 件</font></strong></td>
- </tr>
- <tr>
- <td width="76" height="25" align="right" valign="middle" class="tdbg">
- <div align="center">发信人地址:</div></td>
- <td width="382" height="25" class="tdbg">
- <input type="text" name="frommail" size="20"> </td>
- </tr>
- <tr>
- <td width="76" height="25" align="right" valign="middle" class="tdbg">
- <div align="center">收信人地址:
- </div></td>
- <td width="382" height="25" class="tdbg">
- <input type="text" name="tomail" size="20" value="<%=request("email")%>">
- (如果为空,则向所有会员群发!) </td>
- </tr>
- <tr>
- <td width="76" height="25" class="tdbg">
- <div align="center">信件标题:</div></td>
- <td width="382" height="25" class="tdbg">
- <input type="text" name="mailsubject" size="49" value="影视通知!"> </td>
- </tr>
- <tr>
- <td width="76" height="25" valign="top" class="tdbg">
- <div align="center">信件内容:</div></td>
- <td width="382" height="25" class="tdbg">
- <textarea name="mailbody" cols="48" rows="8"></textarea> <br>
- </td>
- </tr>
- <tr>
- <td height="10" colspan="2" align="center" class="tdbg">
- <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 ="XXX"
- smtpuser ="XXXX"
- smtppwd ="xxxx"
- 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>