sendmail.asp
上传用户:btntkt
上传日期:2021-04-16
资源大小:5296k
文件大小:4k
源码类别:

WEB源码(ASP,PHP,...)

开发平台:

DOS

  1. <!--#include file="conn.asp"-->
  2. <%if session("admin")="" then
  3. response.Write "<script language='javascript'>alert('网络超时或您还没有登陆!');window.location.href='login.asp';</script>"
  4. response.End
  5. end if
  6. %>
  7. <html>
  8. <head>
  9. <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
  10. <link rel="stylesheet" href="CSS.css" type="text/css">
  11. </head>
  12. <BODY background="../images/admin/back.gif">
  13. <%
  14. action=request("action")
  15. if action="send" then
  16. call sendmail()
  17. else
  18. usermail=request.ServerVariables("query_string")
  19. %>
  20. <form action="sendmail.asp" method=post name=usermail>
  21. <table width="98%" border="1"  style="border-collapse: collapse; border-style: dotted; border-width: 0px" bordercolor="#333333" cellspacing="0" cellpadding="2" style="word-break:break-all">
  22. <tr><td colspan=2 background="../images/admin_bg_1.gif" height=25><div align=center>向会员发送邮件</div></td></tr>
  23. <tr><td width=20%  bgcolor='#fbf4f4' align=center>收件人</td>
  24. <td  bgcolor='#fbf4f4'><TEXTAREA NAME="usermail" rows=4 style="width=80% ; overflow:auto;"><%=usermail%></TEXTAREA><br>填写收件人邮箱地址多个邮箱以半角逗号或分号隔开 </td></TR>
  25. <tr><td width=20%  bgcolor='#fbf4f4' align=center>邮件主题</td><td><input type=text name=mail_subject style="width=80%;" maxlength=50>
  26.       &nbsp; </td>
  27.   </TR>
  28. <tr><td width=20%  bgcolor='#fbf4f4' align=center>邮件内容<br><br><font color=red>(1000字符以内)</font></td><td  bgcolor='#fbf4f4'><TEXTAREA NAME="mail_body" ROWS="15" style="width=80% ; overflow:auto;"></TEXTAREA>
  29.       &nbsp; </td>
  30.   </TR>
  31. <tr><td  bgcolor='#fbf4f4'colspan=2>
  32. <input type=hidden name=action value="send">
  33. <input type=submit value="立即发送" onclick="{if(confirm('请注意,不要发送垃圾邮件!nn确认要发送这些邮件吗?确认无误后单击“确定”继续~')){this.document.usermail.submit();return true;}return false;}">
  34. &nbsp; &nbsp; &nbsp; <input type="reset" value="重新填写">
  35. </table>
  36. </form>
  37. <%
  38. end if
  39. sub sendmail()
  40. mail_subject=trim(request("mail_subject"))
  41. mail_body=trim(request("mail_body"))
  42. usermail=trim(request("usermail"))
  43. usermail=replace(usermail," ","")
  44. usermail=replace(usermail,";",";")
  45. usermail=replace(usermail,",",";")
  46. usermail=replace(usermail,",",";")
  47. if usermail="" or mail_subject="" or mail_body="" then
  48. response.write "<script language='javascript'>"
  49. response.write "alert('出错了,收件人、邮件主题、邮件内容必须完整填写。');"
  50. response.write "location.href='javascript:history.go(-1)';"
  51. response.write "</script>"
  52. response.end
  53. end if
  54. if UBound(split(usermail,";"))>20 then
  55. response.write "<script language='javascript'>"
  56. response.write "alert('出错了,您填写的收件人太多了~~');"
  57. response.write "location.href='javascript:history.go(-1)';"
  58. response.write "</script>"
  59. response.end
  60. end if
  61. Set rs = conn.Execute("select * from webinfo") 
  62. adm_mail=rs("webemail")
  63. mailserver=rs("mailaddress")
  64. mailname=rs("mailsend")
  65. mailpassword=rs("mailuserpass")
  66. sitename=rs("webname")
  67. set rs=nothing
  68. dim msg
  69. Set msg = Server.CreateObject("JMail.Message")
  70. msg.silent = true
  71. msg.Logging = true
  72. msg.Charset = "gb2312"
  73. msg.MailServerUserName = mailname
  74. msg.MailServerPassword = mailpassword
  75. msg.From = mailname
  76. msg.FromName = sitename
  77. user_mail=split(usermail,";")
  78. for N=0 to UBound(user_mail)
  79. msg.AddRecipient user_mail(n)
  80. next
  81. msg.Subject = mail_subject
  82. msg.Body = mail_body
  83. msg.Send (mailserver)
  84. msg.close
  85. set msg = nothing
  86. response.write "<script language='javascript'>"
  87. response.write "alert('恭喜,邮件已经发出。');"
  88. response.write "location.href='user3.asp';"
  89. response.write "</script>"
  90. response.end
  91. end sub
  92. %>