<%@ Language=VBScript %>
<!--#include virtual="/inc-freehost-function/FreeHostEmail.asp"-->
<!--#include virtual="/inc-freehost-function/FreeHostFunctionMain.asp"-->
<%
server.ScriptTimeout =3600
If session("admau")="" Then
	ef=True
	ec="授权非法，有可能是超时造成的。"
elseIf session("canmailuser")="" 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"
if Request.QueryString ("type")="agent" then totable="FreeHost.FreeHost_Agent"
if Request.QueryString ("da") ="all" then Sql="Select * from "&totable&""
if Request.QueryString ("da") ="30" then Sql="Select * from "&totable&" where endtime<'"&dateadd("d",30,now)&"' and emailstatus is null"
if Request.QueryString ("da") ="7" then Sql="Select * from "&totable&" where endtime<'"&dateadd("d",7,now)&"' and emailstatus='a'"
if Request.QueryString ("da") ="onlymain" then Sql="Select * from "&totable&" where agentdegree=0"
if Request.QueryString ("da") ="onlysub" then Sql="Select * from "&totable&" where agentdegree>0"

if Request.QueryString ("type")="agent" then Sql=sql&" and agenttype<>'n'"

sql=Replace(sql,"FreeHost_Agent and ","FreeHost_Agent where ")

'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("html8")%>
 　群发邮件
 <%=htmlwrite("html9")%>

   <br>
   <br>
   提取邮箱成功<br>
   <br>

<%

session("gemail")=""
session("gemailcount")=dsph.recordcount
session("gemailsubject")=Request.Form ("suject")
session("gemailbody")=Request.Form ("body")
m=""
while not dsph.eof


if instr(m,dsph("email"))<1 then
m=m&dsph("email")&";"'&vbcrlf
end If
'session("gemail")=session("gemail")&dsph ("email")&";"

dsph.movenext
Wend

session("gemail")=m

dsph.close
set dsph=Nothing

%>


 <a href="gemaildoing.asp" target="_blank">需要发送的邮箱已从数据库中提取，点这儿马上发送>>>>>>>>>>>>></a></p>
 <p><a href="gemailto.asp" target="_blank">点这儿查看目标邮箱列表>>>>>>>>>>>>></a></p>
 <p>
    

<%=htmlwrite("html10")%>
<%end if
if ef then
Response.Redirect "e.asp?e="&ec
end if%>
