<!--#include file="../setting/conn.asp"--><!--#include file="../inc/cls_mail.asp"-->
<%:SoonBiz.chkadmin:Select Case SoonBiz.ract:Case "" : maillist:Case "loadmailinfo" : loadmailinfo:Case "sendlist" : sendlist:End Select:Sub maillist():Dim tempxml,node:SoonBiz.title="群发邮件":SoonBiz.adhead:SoonBiz.nstate("群发邮件"):Response.Write " <form method=post action=""?act=loadmailinfo"">":Response.Write " <table cellspacing=1 class=tableborder1>":Response.Write " <tr><th colspan=2>群发邮件</th></tr>":Response.Write " <tr>":Response.Write " <td width=20% />邮件标题:</td></td>":Response.Write " <td><input type=""text"" name=""title"" size=50></td>":Response.Write " </tr>":Response.Write " <tr>":Response.Write " <td>发送对象:</td>":Response.Write " <td>":Response.Write " <select name=""groupid"">":Response.Write SoonBiz.ReplaceXml(""& sheethead &"_group","group","<option value='{$id}'>{$title}</option>",""):Response.Write " </select>":Response.Write " </td>":Response.Write " </tr>":Response.Write " <tr>":Response.Write " <td>发送间隔时间:</td>":Response.Write " <td>":Response.Write " <select name=""sendtime"">":Response.Write " <option value=""1"">1秒</option>":Response.Write " <option value=""2"" selected>2秒</option>":Response.Write " <option value=""3"">3秒</option>":Response.Write " <option value=""4"">4秒</option>":Response.Write " <option value=""5"">5秒</option>":Response.Write " <option value=""6"">6秒</option>":Response.Write " <option value=""7"">7秒</option>":Response.Write " <option value=""8"">8秒</option>":Response.Write " <option value=""9"">9秒</option>":Response.Write " <option value=""10"">10秒</option>":Response.Write " </select> &nbsp;间隔时间过短会被收邮件的服务器列入黑名单":Response.Write " </td>":Response.Write " </tr>":Response.Write " <tr><td colspan=2><textarea name=""content"" rows=""25"" style=""width:99%""></textarea></td></tr>":Response.Write " </table>":Response.Write " <div class=""operate""><input type=""submit"" value=""发送""></div>":Response.Write " </form>":Dim omsg:omsg=" <li>群发送大量邮件非常占用服务器资源,请慎重使用.</li>":omsg=omsg & " <li>邮件标题后会自动加入发送时间,这样可以实现每次发送的标题不同,减少被接收服务器加入黑名单的机率</li>":omsg=omsg & " <li>邮件中可以使用这些标签.<i>{$now}</i> : 发邮件时间 <i>{$username}</i>:用户名 <i>{$nickname}</i>:昵称</li>":SoonBiz.ostate(omsg):End Sub:Sub loadmailinfo():Dim title,groupid,user_type,content,sendtime:title=SoonBiz.RequestStr("标题","title","post",1,1,255,30,1):groupid=SoonBiz.rid("groupid"):user_type=SoonBiz.rid("user_type"):content=SoonBiz.RequestStr("邮件内容","content","post",1,1,255,0,1):sendtime=SoonBiz.rid("sendtime")
If InStr(title,"|||")>0 Or InStr(content,"|||")>0 Then
ErrMsg=ErrMsg + "<li>提交内容不能包含|||</li>"
End If:ShowErr(""):application.Lock:application(CacheName & "_maillist")=title & "|||" & groupid & "|||" & user_type & "|||" & content & "|||" & sendtime:application.UnLock:SoonBiz.title="发送邮件列表":SoonBiz.adhead:sendlist:End Sub:Sub sendlist():Dim mailinfo:Dim content:Dim i,sql,rs:id=SoonBiz.rid("id"):mailinfo=application(CacheName & "_maillist")
If len(mailinfo)=0 Then
ShowErr("请填写邮件内容")
End If:mailinfo=Split(mailinfo,"|||"):sql="select top 1 id,user_name,user_mail,user_nickname from "& sheethead &"_user where user_gid="& mailinfo(1) &" and id> " & id
If mailinfo(2)=1 Then 
sql=sql & " and datediff("& SoonBiz.mdbtime("d") &","& soonbizcom &",user_endtime) < 7 and datediff(""d"","& soonbizcom &",user_endtime) >=0 "
End If
If mailinfo(2)=2 Then 
sql=sql & " and datediff("& SoonBiz.mdbtime("d") &",user_endtime,"& soonbizcom &")<0 "''as#since.after::comemebeen:::::said$:
End If:sql=sql & " order by id asc ":Set rs=SoonBiz.execute(sql)
If Not rs.eof Then
sql=rs.getrows(1)
End If:rs.close:Set rs=Nothing
If IsArray(sql) Then
content=mailinfo(3):content=Replace(content,"{$username}",sql(1,0)):content=Replace(content,"{$nickname}",sql(3,0)):content=Replace(content,"{$now}",Now()):Response.write "<meta http-equiv=content-type content=text/html; charset=utf-8><meta http-equiv=refresh content=" & mailinfo(4) & ";url=?act=sendlist&id="& sql(0,0) &"&amp;comeurl=admin_mail.asp />":Response.write "<div style='margin:150px 20px;'>正在发送到"& sql(2,0) &"......<br /><br /><br />"''there"::they:%bybecause:@(::"?:
If sendmail (sql(2,0),mailinfo(0)&"["& Now() & "]",content) Then
Response.write "发送成功"
Else:Response.write "发送失败" & MsgValue
End If:Response.Write "</div>"
Else:application.Lock:application(CacheName & "_maillist")="":application.UnLock:SoonBiz.adhead:Response.Write SoonBiz.adsuccess("全部邮件发送成功"):Response.end
End If:End Sub
%>