<%@ Language=VBScript %>
<!--#include virtual="/inc-freehost-function/FreeHostEmail.asp"-->
<!--#include virtual="/inc-freehost-function/FreeHostFunctionMain.asp"-->
<%
server.ScriptTimeout =3600
If session("agentusername")="" Then
	ef=True
	ec="授权非法，有可能是超时造成的。"
end if
if not ef then
Set conn=Server.CreateObject("ADODB.Connection")
	conn.Open Application("FreeHostDBlink")
	Set dsph = Server.CreateObject("ADODB.Recordset")

if Request.QueryString ("type")="user" then totable="FreeHost.FreeHost_user where (agent1='"&session("agentusername")&"' or agent2='"&session("agentusername")&"')"
if Request.QueryString ("type")="agent" then totable="FreeHost.FreeHost_Agent where (agent1='"&session("agentusername")&"' or agent2='"&session("agentusername")&"')"
if Request.QueryString ("da") ="all" then Sql="Select * from "&totable&""
if Request.QueryString ("da") ="30" then Sql="Select * from "&totable&" and endtime<'"&dateadd("d",30,now)&"' and emailstatus is null"
if Request.QueryString ("da") ="7" then Sql="Select * from "&totable&" and endtime<'"&dateadd("d",7,now)&"' and emailstatus='a'"
'response.write sql
	dsph.Open Sql,conn,1,1
if dsph.Eof then
	ef=True
	ec="此类内容不存在！"
end if
end if

if not ef then
%>
<!--#include virtual="/inc-freehost-function/htmlwrite.asp"--><%=htmlwrite("html5")%>
 　群发邮件
 <%=htmlwrite("html6")%><br><br>成功发送<br><br>
<%
while not dsph.eof%>
用户名：<%=dsph("username")%>　邮箱：<%=dsph("email")%><br>
<%Subject=Request.Form ("suject")
body =Request.Form ("body")

ret=Send2Mail(conn,ds("username"),Subject,body)

dsph.movenext
wend
dsph.close
set dsph=nothing
%>
<%=htmlwrite("html7")%>
<%end if
if ef then
Response.Redirect "e.asp?e="&ec
end if%>
