
<!--#include file="./Conn_Mail.asp"-->
<!--#include file="inc/Check.asp"-->
<!--#include file="inc/public.asp"-->
<!--#include file="F.asp"-->
<%
Dim Makking
	Makking      = Trim(Request.QueryString("Makking"))
	ID           = Request.QueryString("ID")
	
Select Case Makking

Case "Send"

		Set Rs = Conn_m.Execute("Select MailTitle,MailContent,MailTitle,MailGroup From SendInfo Where ID="& ID &"")
			IF Not Rs.eof Then
				MailNameStr     = Trim(rs("MailTitle"))
				MailContent     = Trim(rs("MailContent"))
				MailTitle       = Trim(rs("MailTitle"))
				MailGroup       = Rs("MailGroup")
			End IF
			Rs.Close
		Set Rs = Nothing

	m      = Request("m")
	Set Rs = Conn_m.Execute("Select Mail,ID From Mail Where Ending=0 and GroupID="& MailGroup &" order by ID")
		IF Not (Rs.Eof and Rs.bof) Then
			Mail   = Trim(Rs("Mail"))
			MailID = Rs("ID")
		Else
			Response.Write "完成！<A href=SendMail_Lest.asp?ID="& MailGroup &">点这里查看发送结果</A>"
			Response.end
		End IF
		Rs.Close
	Set Rs = Nothing
	
	MailArr = ""
IF Instr(Mail,"@")= False or Instr(Mail,".")= False or Len(Mail)<8 Then
	MailArr = MailArr & "格式不正确|"
	MailStr = True
End IF

'============================================
Set Rs = Conn_m.Execute("Select ID From Leach_Mail where Mail='"& Mail &"'")
	IF Not(Rs.EOF and Rs.BOF) Then
	MailArr = MailArr & "此邮件地址已屏蔽|"
	MailStr = True
	End if 
	Rs.Close
Set Rs = Nothing
'================================================
Comprise_MailStr = False
Set Rs = Conn_m.Execute("Select Mail From Comprise_Mail")
	IF Not(Rs.EOF and Rs.BOF) Then
		While Not Rs.Eof
		IF InStr(Ucase(Mail),""& Ucase(Trim(Rs("Mail"))) &"")>0 Then
		Comprise_MailStr = True
		End IF
		Rs.MoveNext
		Wend
			IF Comprise_MailStr = True Then
			MailArr = MailArr & "此邮件包含有屏蔽内容|"
			MailStr = True
			End iF
	End IF
	Rs.Close
Set Rs = Nothing

IF 	MailStr = True Then

	Conn_m.Execute("update Mail Set Ending=2,MailPicture='"& MailArr &"',dateTime='"& Now() &"' where ID="& MailID &"")
	Response.write "<font color=ff6600>"& Mail &"</font>"& MailArr &"，正在发送下条记录,请稍候..."
	Response.write "<meta http-equiv=""refresh"" content="""& m &";url=MoveSend.asp?Makking=Send&ID="& ID &"&m="& m &""">"
	Response.end

End IF
'==========================================================================================
Set Rs = Conn_m.Execute("Select Top 1 MailName,MailAddress,MailUserName,MailUserPass,MailSend,ID From SendMail_Setup where ok=1 Order By SendTime,ID")

	IF Not Rs.Eof Then

        MailName           = Trim(Rs("MailName"))
        MailAddress        = Trim(Rs("MailAddress"))
        MailUserName       = Trim(Rs("MailUserName"))
        MailUserPass       = Trim(Rs("MailUserPass"))
        MailSend           = Trim(Rs("MailSend"))
		SetupID            = Rs("ID")
		
		Conn_m.Execute("update SendMail_Setup Set SendTime='"& Now() &"' where ID="& SetupID &"")
		
	End IF

	Rs.Close
	Set Rs = Nothing


				Call F_mail()
				
				if err then
						SendEnd = "发送成功"
						ok = 1   
				else
						SendEnd = "发送失败"
						ok = 2   
				end if

			Conn_m.Execute("update Mail Set Ending="& ok &",MailPicture='"& SendEnd &"',dateTime='"& Now() &"' where ID="& MailID &"")

			Response.write "<font color=ff6600>"& Mail &"</font>"& SendEnd &"，正在发送下条记录,请稍候..."
			Response.write "<br>发送邮件地址："& MailSend &""
			Response.write "<meta http-equiv=""refresh"" content="""& m &";url=MoveSend.asp?Makking=Send&ID="& ID &"&m="& m &""">"
			Response.end

Case ""

		Set Rs = Conn_m.Execute("Select MailContent,MailTitle,MailGroup From SendInfo Where ID="& ID &"")
			IF Not Rs.eof Then
			MailContentStr  = Trim(rs("MailContent"))
			MailTitleStr    = Trim(rs("MailTitle"))
			MailGroup       = Trim(Rs("MailGroup"))
			End IF
			Rs.Close
		Set Rs = Nothing
		
	Set Rs = Conn_m.Execute("Select Count(id) as MailCount From Mail Where GroupID="& MailGroup &" and Ending=0")
	MailCount = Rs("MailCount")
		Rs.Close
	Set Rs = Nothing
		
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>ELIGHT.CC</title>
</head>
<link href="Images/Admin.css" rel="stylesheet" type="text/css">
<body>
<table width="98%" height="40"  border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td><table width="100%"  border="0" align="center" cellpadding="2" cellspacing="1" bgcolor="#D8D8D8">
        <tr>
          <td height="30" align="left" bgcolor="ffffff"><table width="100%" height="100%"  border="0" cellpadding="3" cellspacing="0">
              <tr bgcolor="eeeeee">
                <td width="5%" align="center"><img src="Images/1.gif" width="13" height="12"></td>
                <td width="45%"><span class="style2">管理中心 &gt;&gt;&gt; 选择邮件列表</span></td>
                <td width="50%" align="right"></td>
              </tr>
          </table></td>
        </tr>
    </table></td>
  </tr>
</table>
<table width="98%" height="90%"  border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#D8D8D8">
  <tr>
    <td valign="top" bgcolor="ffffff"><table width="96%"  border="0" align="center" cellpadding="0" cellspacing="0">
        <tr> 
          <td align="center" bgcolor="ffffff"> <form method='POST' name="Userform" action='MoveSend.asp?Makking=Send&ID=<%=ID%>'>
              <br>
              <table width=100% border=0 align='center' cellpadding=3 
      cellspacing=1 bordercolordark=#ffffff bgcolor="#Eeeeee" City='size09'>
                <tr bgcolor="ffffff"> 
                  <td width='17%' height="25" align="right">邮件数量：</td>
                  <td width="83%" height="25" bgcolor="ffffff"><%=MailCount%></td>
                </tr>
                <tr bgcolor="ffffff"> 
                  <td width='17%' height="12" align="right" bgcolor="ffffff">发送频率：</td>
                  <td height="12" bgcolor="ffffff"> <select name="m">
                      <option value="1">1秒/封</option>
                      <option value="2">2秒/封</option>
                      <option value="3">3秒/封</option>
                      <option value="5">5秒/封</option>
                      <option value="10">10秒/封</option>
                      <option value="20">20秒/封</option>
                      <option value="30">30秒/封</option>
                      <option value="60">60秒/封</option>
                    </select></td>
                </tr>
                <tr bgcolor="ffffff"> 
                  <td height="12" align="right" bgcolor="ffffff">邮件标题：</td>
                  <td height="12" bgcolor="ffffff"><%=MailTitleStr%></td>
                </tr>
                <tr bgcolor="ffffff">
                  <td height="12" align="right" bgcolor="ffffff">邮件内容：</td>
                  <td height="12" bgcolor="ffffff"><%=MailContentStr%></td>
                </tr>
              </table>
              <p> 
                <input name=Submit type=Submit class="BoxBoult" value="发送">
                &nbsp;
                <input name="Clear" type="reset" class="BoxBoult" value="返回" onClick="javascript:history.go(-1)">
              </p>
            </form></td>
        </tr>
      </table></td>
  </tr>
</table>
<table width="98%"  border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td height="6"></td>
  </tr>
</table>
<%end select
%>
</body>
</html>