<%@ 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("op") ="0" then Sql="Select * from FreeHost.FreeHost_Product_Host where beianstatus is null and (agent1='"&session("agentusername")&"' or agent2='"&session("agentusername")&"') order by starttime desc"
if Request("op") ="1" then Sql="Select * from FreeHost.FreeHost_Product_Host where beianstatus='用户已录入数据' and (agent1='"&session("agentusername")&"' or agent2='"&session("agentusername")&"') order by starttime desc"
if Request("op") ="2" then Sql="Select * from FreeHost.FreeHost_Product_Host where beianstatus='管理员录入数据' and (agent1='"&session("agentusername")&"' or agent2='"&session("agentusername")&"') order by starttime desc"
if Request("op") ="3" then Sql="Select * from FreeHost.FreeHost_Product_Host where beianstatus='管理员已审核' and (agent1='"&session("agentusername")&"' or agent2='"&session("agentusername")&"') order by starttime desc"
if Request("op") ="4" then Sql="Select * from FreeHost.FreeHost_Product_Host where beianstatus='用户需补充数据' and (agent1='"&session("agentusername")&"' or agent2='"&session("agentusername")&"') order by starttime desc"
if Request("op") ="5" then Sql="Select * from FreeHost.FreeHost_Product_Host where beianstatus='已提交工信部' and (agent1='"&session("agentusername")&"' or agent2='"&session("agentusername")&"') order by starttime desc"
if Request("op") ="6" then Sql="Select * from FreeHost.FreeHost_Product_Host where beianstatus='备案审核未通过' and (agent1='"&session("agentusername")&"' or agent2='"&session("agentusername")&"') order by starttime desc"
if Request("op") ="7" then Sql="Select * from FreeHost.FreeHost_Product_Host where beianstatus='备案成功' and (agent1='"&session("agentusername")&"' or agent2='"&session("agentusername")&"') order by starttime desc"
if Instr(1,sql, ";", 1)>0 or Instr(1,sql, "--", 1)>0 then
Response.Write "非法字符！"
Response.End
end if
	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
	Set ds = Server.CreateObject("ADODB.Recordset")
Sql="Select * from FreeHost.FreeHost_USER where username='"&dsph("username")&"'"
	ds.Open Sql,conn,1,1
if not ds.Eof then
%>
用户名：<%=ds("username")%>　邮箱：<%=ds("email")%><br>
<%Subject=Request.Form ("suject")
body =Request.Form ("body")

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


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