<%

dim remark...,Bullcn'Blog - 分享、交流、进步。" /> 后台EMAIL群发 - Bullcn'Blog

后台EMAIL群发


<!-- #include file="include/admin_onlogin.asp" -->
<!-- #include file="include/jk_ip_sys.asp" -->
<%

dim remark
admins=true
nsort="event"
index_url="event"
data_name="user_data"
tit_fir="群发"
tit="邮件群发"

call admin_header(0,0)
%>
<table width="98%" border="0" align="center">
<tr align=center>
<td class=td width='6%'>序号</td>
<td class=td width='12%'>用户名</td>
<td class=td width='12%'>邮件地址</td>
</tr>
<%
sql="select count(id) from "&data_name&sql_add
set rs=joekoe_cms.exec(sql,1)
rssum=rs(0)
rs.close
call format_pagecute()
sql="select top "&nummer*viewpage&" * from "&data_name&sql_add&" order by id desc"
call joekoe_cms.exec(sql,-1)
rs.open sql,conn,1,1
if int(viewpage)>1 then rs.move (viewpage-1)*nummer
if int(viewpage*nummer)>int(rssum) then nums=nummer-(viewpage*nummer-rssum)
for i=1 to nums
%>
<tr align=center>
<td>

<%response.write (viewpage-1)*nummer+i%>
</td>
<td>
<%=rs("username")%>

</td>
<td>
<a href="?email=<%=rs("email")%>"><%=rs("email")%></a>
</td>
</tr>
<%
rs.movenext
next
rs.close
%>
<tr class=tr1>
<td colspan=4> 现有<font class=red>
<%response.write rssum%>
</font>条
<%response.write tit_fir%>
, 每页<font class=red>
<%response.write nummer%>
</font>条, 页次:<font class=red>
<%response.write viewpage%>
</font>/<font class=red>
<%response.write thepages%>
</font> 分页:
<%response.write jk_pagecute(nummer,thepages,viewpage,pageurl,5,"#ff0000")%>
</td>
</tr>
</table>
<table width="799" border="0" align="center">
<tr>
<td><form name="form2" method="post" action="">
<table width="100%" border="0" align="center">
<tr bgcolor="#F9F8EC">
<td width="279"> <div align="right">邮件地址</div></td>
<td width="510"> <input name="email" type="text" id="email" value="<%=request("email")%>" size="50">
群发邮件地址为空</td>
</tr>
<tr bgcolor="#F9F8EC">
<td> <div align="right">邮件主题</div></td>
<td> <input name="Subject" type="text" id="Subject" size="50"></td>
</tr>
<tr bgcolor="#F9F8EC">
<td><div align="right">邮件内容</div></td>
<td><textarea name="Body" COLS="50" ROWS="10"></TEXTAREA> </td>
</tr>
<tr bgcolor="#F9F8EC">
<td> <div align="right"></div></td>
<td><input name="Send" type="submit" id="Send2" value="发送"> </td>
</tr>
<tr bgcolor="#F9F8EC">
<td> <div align="right"></div></td>
<td> </td>
</tr>
</table>
</form></td>
</tr>
</table>
<%
dim Subject,Body,mail,email,jmail
Subject=request("Subject")'邮件主题
Body=request("Body")'邮件内容
mail=request("email")
if request("send")<>"" then
if Body="" then
Response.Write "<script>alert('请输入邮件内容!');history.back();</script>"
Response.End
end if
if Subject="" then
Response.Write "<script>alert('请输入邮件主题!');history.back();</script>"
Response.End
end if
if mail<>"" then
email=mail
call sentemail(email,Subject,Body)
response.write "已经成功向 <b>"&email&"</b> 发送EMAIL"
else
i=0
set rs=server.createobject("adodb.recordset")
sql="select email from "&data_name
rs.open sql,conn,1,1
do while not rs.eof
email=rs("email")
call sentemail(email,Subject,Body)
i=i+1
rs.movenext
loop
rs.close
set rs=nothing
conn.close
set conn=nothing
if i>0 then
response.write "已经成功向 <b>"&i&"</b> 个用户发送EMAIL"
else
response.write "数据表中没有记录<br>"
  
end if
end if
end if
sub sentemail(email,Subject,Body)
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 email '邮件收件人的地址
jmail.From = "cms@joekoe.com" '发件人的E-MAIL地址
jmail.MailServerUserName = "bbwk.com" '登录邮件服务器所需的用户名
jmail.MailServerPassword = "bbwk.com" '登录邮件服务器所需的密码
jmail.Subject = Subject '邮件的标题
jmail.Body = Body '邮件的内容
jmail.Send("10.10.10.10") '执行邮件发送(通过邮件服务器地址)
jmail.Close() '关闭对象
end sub

%>
http://www.joekoe.com/forum_view.asp?forum_id=7&view_id=59821&page=1

文章来自: Original
引用通告: 查看所有引用 | 我要引用此文章
Tags:
相关日志:
评论: 8 | 引用: 0 | 查看次数: 579
发表评论
昵 称:
密 码: 游客发言不需要密码.
内 容:
验证码: 验证码
选 项:
虽然发表评论不用注册,但是为了保护您的发言权,建议您注册帐号.
字数限制 20 字 | UBB代码 关闭 | [img]标签 关闭