<%@ 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 dsregagn = Server.CreateObject("ADODB.Recordset")	
		Sql="Select * from FreeHost.FreeHost_AGENT where username='"&session("agentusername")&"'"
		dsregagn.Open Sql,conn,1,1
If IsNull(dsregagn("Mailfrom")) Then
	ef=True
	ec="用户管理中的发件人等信息没有设置，请先设置它。"
End If
End If


if not ef then
	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 ("da") ="all" then Sql="Select * from "&totable&""
	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")%>
 　
 <p>群发邮件
   <%=htmlwrite("html6")%>
   <br>
   <br>
   提取邮箱成功<br>
   <br>
   <%

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

while not dsph.eof
'Subject=Request.Form ("suject")
'body =Request.Form ("body")



session("gemail")=session("gemail")&dsph ("email")&";"

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

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