
<!--#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           = Trim(Request.QueryString("ID"))
Select Case Makking

Case "Send"

	Mail            = Trim(Request.Form("ToMail"))
	MailNameStr     = Trim(Request.Form("MailTitle"))
	MailContent     = Trim(Request.Form("Body"))
	MailTitle       = Trim(Request.Form("MailTitle"))
	MailGroup       = Trim(Request.Form("MailGroup"))


	IF ID = "" or Not IsNumeric(ID) Then
		Conn_m.Execute("Insert Into SendInfo (MailGroup,MailName,MailTitle,MailContent,DateTime) values ("& MailGroup &",'"& MailNameStr &"','"& MailTitle &"','"& MailContent &"','"& Now() &"')")
	
		Conn_m.Execute("update Mail Set Ending=0 Where GroupID="& MailGroup &" and Ending<>0")
		
		Set Rs = Conn_m.Execute("Select Top 1 * From SendInfo order By DateTime Desc")
			IF Not Rs.eof Then
			ID = Rs("ID")
			End IF
			Rs.Close
		Set Rs = Nothing
	Else
		Conn_m.Execute("Update SendInfo Set MailGroup="& MailGroup &",MailName='"& MailNameStr &"',MailTitle='"& MailTitle &"',MailContent='"& MailContent &"',DateTime='"& Now() &"' where ID="& ID &"")
	End IF
		
	Response.Redirect("MoveSend.asp?ID="& ID &"")

Case ""

	IF ID <> "" Then	
		Set Rs = Conn_m.Execute("Select * From SendInfo Where ID="& ID &"")
			IF Not Rs.eof Then
			MailTitleStr    = Trim(Rs("MailTitle"))
			End IF
			Rs.Close
		Set Rs = Nothing
	End IF
%>
<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='SendMail.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"> <select name="MailGroup">
                      <%
			sql="select * from Mail_Group order by datetime desc" 
			set rs=server.createobject("adodb.recordset") 
			rs.open sql,conn_m,1,1
			if not(rs.bof and rs.eof) then
			do while not rs.eof
%>
                      <option value="<%=rs("GroupID")%>"><%=rs("Groupname")%></option>
                      <%
			rs.movenext
			loop
			end if
			rs.close
			set rs=nothing
%>
                    </select> </td>
                </tr>
                <tr bgcolor="ffffff"> 
                  <td width='17%' height="25" align="right" bgcolor="ffffff">邮件标题：</td>
                  <td height="25" bgcolor="ffffff"> <input name="MailTitle" type=text class="box6" id="MailTitle" value="<%=MailTitleStr%>" size=50> 
                  </td>
                </tr>
                <tr bgcolor="ffffff"> 
                  <td width='17%' height="25" align="right">邮件内容：<br> </td>
                  <td height="25"> 
                    <%EditNumberID="WebMaster"%>
                    <!--#include file="Edit/Edit.asp"--> <br> <script language="javascript">
document.write ('<iframe src="textbox.asp?Makking=MailSend&ID=<%=ID%>" id="message" width="98%" height="250" align=left></iframe>')
frames.message.document.designMode = "On";
          </script> </td>
                </tr>
              </table>
              <p> 
                <input type="hidden" name="body" value="">
                <input name=Submit type=Submit class="BoxBoult" id="Submit" OnClick="document.Userform.body.value = frames.message.document.body.innerHTML;" 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
Conn_m.Close
Set Conn_m = Nothing
%>
</body>
</html>