28,406
社区成员
发帖
与我相关
我的任务
分享
<%
Server.ScriptTimeout=9999999
%>
<%
set conn = server.CreateObject("adodb.connection")
on error resume next
conn.Open "driver={microsoft access driver (*.mdb)}; dbq=" & server.MapPath("2u3@#langxin.mdb")
set rs1=Server.CreateObject("ADODB.Recordset")
sql="select * from config where id=1"
rs1.open sql,conn,1,1
smtp =rs1("pcsmtpserver")'发送邮件所使用的SMTP服务器
username =rs1("pcsmtpuser") '与SMTP服务器对应的邮箱用户名
userpassword =rs1("pcsmtppwd") '与SMTP服务器对应的邮箱密码
useremail =rs1("pcsmtpemail") 'SMTP服务器发信邮箱
hemail=rs1("pcsmtphuifu") '回复的邮箱
%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
</head>
<body>
<table border="0" width="100%" id="table1" cellspacing="0" cellpadding="0" height="100%">
<tr>
<td align=center>
</td>
<%
set rs = Server.CreateObject("ADODB.Recordset")
sql="select email from mail"
rs.open sql,conn,1,1
totalcount=request("totalcount")
if isnull(totalcount) or totalcount="" then
totalcount=0
end if
dim email,nowpage
'***********************************分页
count=cint(session("sendnum"))
if not rs.eof then
rs.pagesize=count
pagecount=rs.pagecount
if request("pageid")="" then
nowpage=1
else
nowpage=int(request("pageid"))
end if
if nowpage>rs.pagecount then
response.write "发送完毕,服务器:"&smtp&" 总共发送邮件 <b> <font color=red>"&totalcount&" </font> </b>"
response.end
end if
if nowpage>=rs.pagecount then
nowpage=rs.pagecount
elseif nowpage <=1 then
nowpage=1
end if
rs.absolutepage=nowpage
else
pagecount=1
nowpage=1
end if
a=1
Dim JMail,msg
Set JMail = Server.CreateObject("JMail.Message")
do while not rs.eof and a <=count
JMail.Charset = "gb2312"
JMail.ContentType = "text/html"
JMail.From = useremail
JMail.FromName = session("sendername")
JMail.Subject = session("title")
jmail.ReplyTo = hemail
JMail.AddHeader "Originating-IP", Request.ServerVariables("REMOTE_ADDR")
JMail.ClearRecipients()
for i=1 to 10
if not rs.eof and a <=count then
email=rs(0)
JMail.AddRecipient(email)
a=a+1
rs.movenext
end if
next
JMail.Body = session("content")
msg=JMail.Send(smtp)
loop
rs.close
set rs=nothing
conn.close
set conn=nothing
' 关闭并清除对象
JMail.Close()
Set JMail = Nothing
totalcount=cint(totalcount)+cint(a)-1
%>
正在发送中。。。已发送邮件 <b> <font color=red> <%=totalcount%> </font> </b>封
</tr>
</table>
</table>
<meta http-equiv="refresh" content=" <%=session("sendtime")%>;URL=email_send.asp?pageid= <%=cint(nowpage)+1%>&totalcount= <%=totalcount%>">
</body>
</html>