<%@LANGUAGE="VBSCRIPT" CODEPAGE="949"%>
<!--#include file="opendb.asp" -->
<%
Server.ScriptTimeout = 10000
Response.Buffer = False
send_type = request("s_member")
send_name = request("send_name")
send_subject = request("mail_subject")
send_content = request("mail_content")
if request("page") = "" then
page = 1
else
page = request("page")
end if
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''' 전체 메일 보내기 일때'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
'sql = "select email from userdbml where gjg =1 and email !='' order by number desc"
sql = "select email from userdbml where id='bj0806'"
Set rs = Server.CreateObject("ADODB.Recordset")
rs.pagesize = 500
rs.open sql,Db,3
if Rs.eof or Rs.bof then
%>
<script language="javascript">
<!--
alert('전체메일을 모두 발송 하였습니다.nn메일링 페이지로 이동 합니다');
location.href='mailling.asp';
//-->
</script>
<%
Else
totalpage = rs.pagecount
R_count = rs.recordcount - rs.pagesize * page
R_count1 = rs.recordcount - R_count
rs.AbsolutePage = page
i = 1
Do until rs.eof or rs.bof
'Do until rs.eof or i > rs.pagesize '이메일 갯수만큼 돌면서 메일 보내기
Set M = Server.CreateObject("CDONTS.NewMail")
M.To = rs("email")
M.From = send_name
M.Subject = send_subject
M.BodyFormat = 0
M.MailFormat = 0
M.Body = send_content
M.Send
Set M = Nothing
rs.movenext
i= i +1
Loop
%>
<html>
<head>
<script language="javascript">
<!--
function L_mail()
{
alert("<%=R_count1%>통 발송 하였습니다.nn<%=page%>페이지/전체<%=totalpage%>페이지");
document.emailing.submit();
}
//-->
</script>
</head>
<body onLoad="L_mail();">
<form name="emailing" action="maillingOk.asp" method="post">
<input type="hidden" name="page" value="<%=cint(page)+1%>">
<input type="hidden" name="s_member" value="<%=send_type%>">
<input type="hidden" name="send_name" value="<%=send_name%>">
<input type="hidden" name="mail_subject" value="<%=send_subject%>">
<textarea name="mail_content" rows="20" cols="75"><%=send_content%></textarea>
</form>
</body>
</html>
<%
end If
rs.close
Set rs = Nothing
%>