<!--#include file="conn.asp"-->
<%if session(hxCacheName&"_admin")<>"OK" then
    response.redirect("admin_login.asp")
    end if
 if request.cookies(hxCacheName&"_rank")("rank")>2 then
  	response.write "<script language='javascript'>"
	response.write "alert('您的级别不够！');"
	response.write "location.href='javascript:history.go(-1)';"			
	response.write "</script>"
    end if%>

<%'===========================================
'天天智能友情链接管理系统
'天天DV网制作 http://www.ttdv.cn
'博大网址库http://www.ip126.com

'可自由传播和免费使用，但必须保留此完整版权信息
'本程序撷取了ITlearner、博大网址库智能友情链接系统、飞
'越智能友情链接系统等优秀程序中的源代码，对他们的作者表示感谢
'=============================================
%>
<script language=javascript src=../images/mouse_on_title.js></script>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="../style.css" rel="stylesheet" type="text/css">
<BODY background="../images/back.gif">
<script language=javascript>
<!--
function CheckAll(form){
for (var i=0;i<form.elements.length;i++){
var e = form.elements[i];
if (e.name != 'chkall') e.checked = form.chkall.checked; 
}
}
-->
</script>
</head>
<BODY background="../images/back.gif">

<%dim action,email,rs,sql
action=request("action")
if action="send" then
call sendmail()
else
email=request.ServerVariables("query_string")
%>
<form action="sendmail.asp" method=post name=email>
<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">
<tr><td colspan=2 bgcolor="#BDBEDE" height=18>向会员发送邮件</td></tr>
<tr><td width=20% align=center>收件人</td>
<td><TEXTAREA NAME="email" rows=4 style="width=80% ; overflow:auto;"><%=email%></TEXTAREA>&nbsp; <img align=top src=../images/memo.gif alt="填写收件人邮箱地址<br>多个邮箱以半角逗号或分号隔开<br><font color=red>千万不要发垃圾邮件哦~后果很严重</font>"> </td></TR>
<tr><td width=20% align=center>邮件主题</td><td><input type=text name=mail_subject style="width=80%;" maxlength=50>&nbsp; <img src=../images/memo.gif alt="填写邮件主题<br><font color=red>技巧：好的主题吸引人点击阅读<br>差的主题可能会被直接删除</font>"> </td></TR>
<tr><td width=20% align=center>邮件内容<br><br><font color=red>（1000字符以内）</font></td><td><TEXTAREA NAME="mail_body" ROWS="15" style="width=80% ; overflow:auto;"></TEXTAREA>&nbsp; <img align=top src=../images/memo.gif alt="支持html<br>但若收件人的邮箱不支持html<br>则看到的是一堆代码而矣"> </td></TR>
<tr><td colspan=2 bgcolor='#DADAE9'>
<input type=hidden name=action value="send">
<input type=submit value="立即发送" onclick="{if(confirm('请注意，不要发送垃圾邮件！（人家很生气，后果很严重~~~）\n\n确认要发送这些邮件吗？确认无误后单击“确定”继续~')){this.document.email.submit();return true;}return false;}">
&nbsp; &nbsp; &nbsp; <input type="reset" value="重新填写">
</table>
</form>
<%dim mail_subject,mail_body,mailserver,mailpassword,sitename,mailname,web
end if
sub sendmail()
mail_subject=trim(request("mail_subject"))
mail_body=trim(request("mail_body"))
email=trim(request("email"))
email=replace(email," ","")
email=replace(email,"；",";")
email=replace(email,"，",";")
email=replace(email,",",";")
if email="" or mail_subject="" or mail_body="" then
response.write "<script language='javascript'>"
response.write "alert('出错了，收件人、邮件主题、邮件内容必须完整填写。');"
response.write "location.href='javascript:history.go(-1)';"
response.write "</script>"
response.end
end if
if UBound(split(email,";"))>20 then
response.write "<script language='javascript'>"
response.write "alert('出错了，您填写的收件人太多了,限20个！~~');"
response.write "location.href='javascript:history.go(-1)';"
response.write "</script>"
response.end
end if

mailserver=servesmtp		
mailname=servemail			
mailpassword=servekey
sitename=WebName
web=WebUrl
mail_body=mail_body+"◆欢迎光临"+WebName+web	

dim msg,user_mail,n
Set msg = Server.CreateObject("JMail.Message")
msg.silent = true
msg.Logging = true
msg.Charset = "gb2312"
msg.MailServerUserName = mailname
msg.MailServerPassword = mailpassword
msg.From = mailname
msg.FromName = sitename
user_mail=split(email,";")
for N=0 to UBound(user_mail)
msg.AddRecipient user_mail(n)
next
msg.Subject = mail_subject
msg.Body = mail_body
msg.Send (mailserver)
msg.close
set msg = nothing

response.write "<script language='javascript'>"
response.write "alert('恭喜，邮件已经发出。');"
response.write "location.href='sendmail_user.asp';"
response.write "</script>"
response.end

end sub
%>