<%@ Language=VBScript %>
<%
s=3'定义发信间隔 秒
If session("admau")="" Then
	ef=True
	ec="授权非法，有可能是超时造成的。"
elseIf session("canmailuser")="" Then
	ef=True
	ec="您没有此操作的权限。"
end if

if not ef Then

session("Mail_from")=Application("Mail_from")
session("Mail_fromName")=Application("Mail_fromName")
session("Mail_fromPass")=Application("Mail_fromPass")
session("Mail_fromServer")=Application("Mail_fromServer")

arryemail=split(session("gemail"),";")
If ubound(arryemail)<1 Then
	ef=True
	ec="邮箱已发送完成或邮箱列表为空。"
session("gemailcount")=0
End If

end if
if not ef Then
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>运行中...............................</title>
<meta http-equiv="refresh" content="<%=s%>;URL=gemaildoing.asp">
</head>
<body>
<%





If arryemail(0)<>"" Then

     Set jmail = Server.CreateObject("JMAIL.Message")   '建立发送邮件的对象
     jmail.silent = true    '屏蔽例外错误，返回FALSE跟TRUE两值j
     jmail.logging = true   '启用邮件日志
     jmail.Charset = "GB2312"     '邮件的文字编码为国标
     jmail.ContentType = "text/html"    '邮件的格式为HTML格式
     jmail.AddRecipient  arryemail(0)   '邮件收件人的地址
     jmail.From =  session("Mail_from")  '发件人的E-MAIL地址
	 jmail.FromName = session("Mail_fromName")
     jmail.MailServerUserName = session("Mail_from")     '登录邮件服务器所需的用户名
     jmail.MailServerPassword = session("Mail_fromPass")     '登录邮件服务器所需的密码
     jmail.Subject = session("gemailsubject")    '邮件的标题 
     jmail.Body = session("gemailbody")     '邮件的内容
	 response.write "正在发送给："&arryemail(0) &"<br>"

	if not jmail.Send( session("Mail_fromServer") ) Then
'	response.write "发送邮件出错:发件人:"&session("Mail_fromName")&":"& session("Mail_from")&"/"&session("Mail_fromPass")&" 收件人："&arryemail(0)&"信息："&jmail.log
	response.write "发送邮件出错:发件人:"&session("Mail_fromName")&":"& session("Mail_from")&" 收件人："&arryemail(0)&"信息："&jmail.log
	end if
	    jmail.Close()   '关闭对象

End if


doingmail=""
for i=1 to ubound(arryemail)
If arryemail(i)<>"" And arryemail(i)<>";" then
doingmail=doingmail&arryemail(i)&";"
'response.Write i&arryemail(i)&"<br>"
End if
Next

response.Write now&" 共需要发送邮箱数："&session("gemailcount")&"个 等待发送数量："&ubound(arryemail)-1&"个<br>"&s&"秒后发送下一个邮件，请不要关闭本页....</body></html>"

session("gemail")=doingmail

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