<!--#include file="../include/hf_conn.asp"-->
<!--#include file="checkadmin.asp"-->
<script language=javascript src=../include/mouse_on_title.js></script>
<%call checkmanage("05")%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link rel="stylesheet" href="manage.css" type="text/css">
</head>
<BODY background="../images/admin/back.gif">
<%
action=request("action")
if action="send" then
call sendmail()
else
usermail=request.ServerVariables("query_string")
%>
<form action="sendmail.asp" method=post name=usermail>
<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 class=td height=18>向会员发送邮件</td></tr>
<tr><td width=20% align=center>收件人</td>
<td><TEXTAREA NAME="usermail" rows=4 style="width=80% ; overflow:auto;"><%=usermail%></TEXTAREA>&nbsp; <img align=top src=../images/admin/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/admin/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/admin/memo.gif alt="支持html<br>但若收件人的邮箱不支持html<br>则看到的是一堆代码而矣"> </td></TR>
<tr><td colspan=2>
<input type=hidden name=action value="send">
<input type=submit value="立即发送" onclick="{if(confirm('请注意，不要发送垃圾邮件！（人家很生气，后果很严重~~~）\n\n确认要发送这些邮件吗？确认无误后单击“确定”继续~')){this.document.usermail.submit();return true;}return false;}">
&nbsp; &nbsp; &nbsp; <input type="reset" value="重新填写">
</table>
</form>
<%
end if
sub sendmail()
mail_subject=trim(request("mail_subject"))
mail_body=trim(request("mail_body"))
usermail=trim(request("usermail"))
usermail=replace(usermail," ","")
usermail=replace(usermail,"；",";")
usermail=replace(usermail,"，",";")
usermail=replace(usermail,",",";")
if usermail="" 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(usermail,";"))>20 then
response.write "<script language='javascript'>"
response.write "alert('出错了，您填写的收件人太多了~~');"
response.write "location.href='javascript:history.go(-1)';"
response.write "</script>"
response.end
end if
Set rs = conn.Execute("select * from hfvipsetup") 
jmail=rs("jmail")
adm_mail=rs("adm_mail")			
qf_mailyesorno=rs("qf_mailyesorno")
mailserver=rs("mailserver")		
mailname=rs("mailname")			
mailpassword=rs("mailpassword")		
set rs=nothing
if qf_mailyesorno=1 then
dim msg
if jmail=0 then
Set objMail = Server.CreateObject("CDONTS.NewMail")
objMail.To = UserMail
objMail.From =mailname
objMail.Subject = mail_subject
objMail.Body = mail_body
objMail.Send
Set objMail = Nothing
else
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(usermail,";")
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
end if
response.write "<script language='javascript'>"
response.write "alert('恭喜，邮件已经发出。');"
response.write "location.href='user3.asp';"
response.write "</script>"
response.end
else
response.write "<script language='javascript'>"
response.write "alert('抱歉，邮件功能没有打开。');"
response.write "location.href='user3.asp';"
response.write "</script>"
response.end
end if
end sub
%>