회원메일 보낼때 질문입니다.. 정보
회원메일 보낼때 질문입니다..본문
다시질문드릴께요..
관리자 메뉴에서 회원메일 발송부분요
거기서 {이름}{생일} 이런식으로
회원 각자의 정보를 메일이 포함해서 보낼수있잖아요?
그렇다면..
"회원가입일" <-- 이놈을 메일에 포함시키려면 어찌해야 하나요..
별별 짓을 다해봐도..
안되네요..
부디..해결책을...^^:;
관리자 메뉴에서 회원메일 발송부분요
거기서 {이름}{생일} 이런식으로
회원 각자의 정보를 메일이 포함해서 보낼수있잖아요?
그렇다면..
"회원가입일" <-- 이놈을 메일에 포함시키려면 어찌해야 하나요..
별별 짓을 다해봐도..
안되네요..
부디..해결책을...^^:;
댓글 전체
회원 가입일은 $mb_datetime 입니다~~~`
$mb_reg_date = substr($mb[mb_datetime],0,10); <--- 0000-00-00 형식
$mb_reg_date = substr($mb[mb_datetime],0,19); <--- 0000-00-00 00:00:00 형식
즉 $mb_reg_date 을 넣어 보세요
$mb_reg_date = substr($mb[mb_datetime],0,10); <--- 0000-00-00 형식
$mb_reg_date = substr($mb[mb_datetime],0,19); <--- 0000-00-00 00:00:00 형식
즉 $mb_reg_date 을 넣어 보세요
앗..이렇게 빨리..답이..^^:;
일단 해보겠습니다..감사합니다..
일단 해보겠습니다..감사합니다..
죄송합니다만..php에대한 지식이 전혀 없습니다...^^:;;
그래서..전부다해봤는데..아는한도내에서..^^;; 안되네요..
<?=$mb[mb_datetime]?>
$mb_reg_date = substr($mb[mb_datetime],0,10); <--- 0000-00-00 형식
$mb_reg_date = substr($mb[mb_datetime],0,19); <--- 0000-00-00 00:00:00 형식
<?=$mb_reg_date?>
<?=$mb_reg_date ?>
<?$mb_reg_date?>
<?$mb_reg_date = substr($mb[mb_datetime],0,19); ?>
<?$mb_reg_date = substr($mb[mb_datetime],0,19);?>
<?=$mb_reg_date = substr($mb[mb_datetime],0,19); ?>
<?=$mb_reg_date = substr($mb[mb_datetime],0,19); ?>
문법을 몰라서 이렇게...죄다 해봤지만..^^;;;안됩니다..
어떻게 적용하는지도..알려주심안될까요^^;;;
그래서..전부다해봤는데..아는한도내에서..^^;; 안되네요..
<?=$mb[mb_datetime]?>
$mb_reg_date = substr($mb[mb_datetime],0,10); <--- 0000-00-00 형식
$mb_reg_date = substr($mb[mb_datetime],0,19); <--- 0000-00-00 00:00:00 형식
<?=$mb_reg_date?>
<?=$mb_reg_date ?>
<?$mb_reg_date?>
<?$mb_reg_date = substr($mb[mb_datetime],0,19); ?>
<?$mb_reg_date = substr($mb[mb_datetime],0,19);?>
<?=$mb_reg_date = substr($mb[mb_datetime],0,19); ?>
<?=$mb_reg_date = substr($mb[mb_datetime],0,19); ?>
문법을 몰라서 이렇게...죄다 해봤지만..^^;;;안됩니다..
어떻게 적용하는지도..알려주심안될까요^^;;;
죄송합니다...관리자 메뉴네요.....
그러면
admin/mail_select_update.php 에서
47번째 줄
list($email, $mb_id, $name, $nick, $birth) = explode("||", trim($member_list[$i])); 를
list($email, $mb_id, $name, $nick, $birth, $datetime) = explode("||", trim($member_list[$i]));
61 번째 줄 아래에
$content = preg_replace("/{회원가입일}/", $datetime, $content);
을 추가 보시고 보내실때 {회원가입일} 해 보십시오
그러면
admin/mail_select_update.php 에서
47번째 줄
list($email, $mb_id, $name, $nick, $birth) = explode("||", trim($member_list[$i])); 를
list($email, $mb_id, $name, $nick, $birth, $datetime) = explode("||", trim($member_list[$i]));
61 번째 줄 아래에
$content = preg_replace("/{회원가입일}/", $datetime, $content);
을 추가 보시고 보내실때 {회원가입일} 해 보십시오
죄송합니다....검증되지 않은 답을 드려서
아래 내용들을 각 화일 에 덮어 씌우십시오(검증됨)
다시 한 번 죄송하다는 말씀 드립니다.
*** adm/mail_form.php ***
<?
$sub_menu = "200300";
include_once("./_common.php");
auth_check($auth[$sub_menu], "r");
$html_title = "회원메일";
if ($w == "u") {
$html_title .= "수정";
$readonly = " readonly";
$sql = " select * from $g4[mail_table] where ma_id = '$ma_id' ";
$ma = sql_fetch($sql);
if (!$ma[ma_id])
alert("등록된 자료가 없습니다.");
} else {
$html_title .= "입력";
}
$g4[title] = $html_title;
include_once("./admin.head.php");
?>
<table cellpadding=0 cellspacing=0 width=100%>
<form name=fmailform method=post action="./mail_update.php" onsubmit="return fmailform_check(this);">
<input type=hidden name=w value='<? echo $w ?>'>
<input type=hidden name=ma_id value='<? echo $ma[ma_id] ?>'>
<colgroup width=20% class='col1 pad1 bold right'>
<colgroup width=80% class='col2 pad2'>
<tr>
<td colspan=2 class=title align=left><img src='<?=$g4[admin_path]?>/img/icon_title.gif'> <?=$html_title?></td>
</tr>
<tr><td colspan=2 class='line1'></td></tr>
<tr class='ht'>
<td>메일 제목</td>
<td><input type=text class='ed w99' name=ma_subject value='<?=$ma[ma_subject]?>' required itemname='메일 제목'></td>
</tr>
<tr>
<td>메일 내용</td>
<td class=lh>
<?=textarea_size("ma_content")?>
<textarea id=ma_content name=ma_content rows=20 class='ed w99' required itemname='메일 내용'><?=$ma[ma_content]?></textarea>
<br>{이름} , {별명} , {회원아이디} , {이메일} , {생일} , {회원가입일}
<br>위와 같이 HTML 코드에 삽입하면 해당 내용에 맞게 변환하여 메일 발송합니다.
</td>
</tr>
<tr><td colspan=2 class='line1'></td></tr>
</table>
<p align=center>
<input type=submit class=btn1 accesskey='s' value=' 확 인 '>
</form>
<script language="javascript">
function fmailform_check(f)
{
errmsg = "";
errfld = "";
check_field(f.ma_subject, "제목을 입력하세요.");
check_field(f.ma_content, "내용을 입력하세요.");
if (errmsg != "") {
alert(errmsg);
errfld.focus();
return false;
}
return true;
}
document.fmailform.ma_subject.focus();
</script>
<?
include_once("./admin.tail.php");
?>
**adm/mail_select_list.php ********
<?
$sub_menu = "200300";
include_once("./_common.php");
auth_check($auth[$sub_menu], "r");
$html_title = "선택된 회원메일리스트";
$ma_last_option = "";
$sql_common = " from $g4[member_table] ";
$sql_where = " where (1) ";
// 회원ID ..에서 ..까지
if ($mb_id1 != 1)
$sql_where .= " and mb_id between '$mb_id1_from' and '$mb_id1_to' ";
// E-mail에 특정 단어 포함
if ($mb_email != "")
$sql_where .= " and mb_email like '%$mb_email%' ";
// 성별
if ($mb_sex != "")
$sql_where .= " and mb_sex = '$mb_sex' ";
// 생일
if ($mb_birth_from && $mb_birth_to)
$sql_where .= " and substring(mb_birth,5,4) between '$mb_birth_from' and '$mb_birth_to' ";
// 지역
if ($mb_area != "")
$sql_where .= " and mb_addr1 like '$mb_area%' ";
// 메일링
if ($mb_mailling != "")
$sql_where .= " and mb_mailling = '$mb_mailling' ";
// 권한
$sql_where .= " and mb_level between '$mb_level_from' and '$mb_level_to' ";
// 게시판그룹회원
if ($gr_id)
{
$group_member = "";
$comma = "";
$sql2 = " select mb_id from $g4[group_member_table] where gr_id = '$gr_id' order by mb_id ";
$result2 = sql_query($sql2);
for ($k=0; $row2=sql_fetch_array($result2); $k++)
{
$group_member .= "{$comma}'$row2[mb_id]'";
$comma = ",";
}
$sql_where .= " and mb_id in ($group_member) ";
}
// 탈퇴, 차단된 회원은 제외
$sql_where .= " and mb_leave_date = '' and mb_intercept_date = '' ";
$sql = " select COUNT(*) as cnt $sql_common $sql_where ";
$row = sql_fetch($sql);
$cnt = $row[cnt];
if ($cnt == 0)
alert("선택하신 내용으로는 해당되는 회원자료가 없습니다.");
// 마지막 옵션을 저장합니다.
$ma_last_option .= "mb_id1=$mb_id1";
$ma_last_option .= "||mb_id1_from=$mb_id1_from";
$ma_last_option .= "||mb_id1_to=$mb_id1_to";
$ma_last_option .= "||mb_email=$mb_email";
$ma_last_option .= "||mb_sex=$mb_sex";
$ma_last_option .= "||mb_birth_from=$mb_birth_from";
$ma_last_option .= "||mb_birth_to=$mb_birth_to";
$ma_last_option .= "||mb_area=$mb_area";
$ma_last_option .= "||mb_mailling=$mb_mailling";
$ma_last_option .= "||mb_level_from=$mb_level_from";
$ma_last_option .= "||mb_level_to=$mb_level_to";
$ma_last_option .= "||gr_id=$gr_id";
sql_query(" update $g4[mail_table] set ma_last_option = '$ma_last_option' where ma_id = '$ma_id' ");
include_once("./admin.head.php");
?>
<table width=500 align=center><tr><td>
<?//=subtitle_bar($html_title)?><p>
<div align=right>선택된 회원수 : <?=number_format($cnt)?> 명</div>
<table cellpadding=4 cellspacing=1 width=100% class=tablebg>
<form name=fmailselectlist method=post action="javascript:fmailselectlist_submit(document.fmailselectlist);">
<input type="hidden" name="ma_id" value="<? echo $ma_id ?>">
<tr>
<td align=center>
<select size=25 name='list' style='width:500px;'>
<option>번호 . 회원아이디 / 이름 / 별명 / 생일 / E-mail / 회원가입일
<?
$sql = " select mb_id, mb_name, mb_nick, mb_email, mb_birth, mb_datetime $sql_common $sql_where order by mb_id ";
$result = sql_query($sql);
$i=0;
$ma_list = "";
$cr = "";
while ($row=sql_fetch_array($result)) {
$i++;
echo "<option>$i . $row[mb_id] / $row[mb_name] / $row[mb_nick] / $row[mb_birth] / $row[mb_email] / $row[mb_datetime]";
$ma_list .= $cr . $row[mb_email] . "||" . $row[mb_id] . "||" . $row[mb_name] . "||" . $row[mb_nick] . "||" . $row[mb_birth] . "||" . $row[mb_datetime];
$cr = "\n";
}
?>
</select>
<textarea name="ma_list" style="display:none"><?=$ma_list?></textarea>
</td>
</tr>
</table>
<p align=center>
<input type=submit class=btn1 value=' 메일 보내기 '>
<input type=button class=btn1 value=' 뒤 로 ' onclick="history.go(-1);">
</form>
</td></tr></table>
<script language='javascript'>
function fmailselectlist_submit(f)
{
f.action = "./mail_select_update.php";
f.submit();
}
</script>
<?
include_once("./admin.tail.php");
?>
****adm/mail_select_update.php *******
<?
$sub_menu = "200300";
include_once("./_common.php");
auth_check($auth[$sub_menu], "w");
$html_title = "회원메일 발송";
check_demo();
include_once("./admin.head.php");
include_once("$g4[path]/lib/mailer.lib.php");
$countgap = 10; // 몇건씩 보낼지 설정
$maxscreen = 500; // 몇건씩 화면에 보여줄건지?
$sleepsec = 200; // 천분의 몇초간 쉴지 설정
echo "<span style='font-size:9pt;'>";
echo "<p>메일 발송중 ...<p><font color=crimson><b>[끝]</b></font> 이라는 단어가 나오기 전에는 중간에 중지하지 마세요.<p>";
echo "</span>";
?>
<span id="cont"></span>
<?
include_once("./admin.tail.php");
?>
<?
flush();
ob_flush();
$ma_id = trim($_POST[ma_id]);
$select_member_list = addslashes(trim($_POST[ma_list]));
//print_r2($_POST); EXIT;
$member_list = explode("\n", $select_member_list);
// 메일내용 가져오기
$sql = "select ma_subject, ma_content from $g4[mail_table] where ma_id = '$ma_id' ";
$ma = sql_fetch($sql);
$subject = $ma[ma_subject];
$cnt = 0;
for ($i=0; $i<count($member_list); $i++) {
list($email, $mb_id, $name, $nick, $birth, $mb_datetime) = explode("||", trim($member_list[$i]));
$sw = ereg("[0-9a-zA-Z_]+(\.[0-9a-zA-Z_]+)*@[0-9a-zA-Z_]+(\.[0-9a-zA-Z_]+)*", $email);
// 올바른 메일 주소만
if ($sw == true) {
$cnt++;
$mb_md5 = md5($mb_id.$mb_email);
$content = $ma[ma_content];
$content = preg_replace("/{이름}/", $name, $content);
$content = preg_replace("/{별명}/", $nick, $content);
$content = preg_replace("/{회원아이디}/", $mb_id, $content);
$content = preg_replace("/{회원가입일}/", substr($mb_datetime,0,10), $content); //추가
$content = preg_replace("/{이메일}/", $email, $content);
$content = preg_replace("/{생일}/", (int)substr($birth,4,2).'월 '.(int)substr($birth,6,2).'일', $content);
$content = $content . "<hr size=0><p><span style='font-size:9pt; font-familye:굴림'>▶ 더 이상 정보 수신을 원치 않으시면 [<a href='$g4[url]/$g4[bbs]/email_stop.php?mb_id=$mb_id&mb_md5=$mb_md5' target='_blank'>수신거부</a>] 해 주십시오.</span></p>";
/*
ob_start();
include "$mail_skin/mail.skin.php";
$content = ob_get_contents();
ob_end_clean();
*/
//mailer($default[de_subject], $default[de_admin_email], $email, $subject, $content, 1);
mailer($config[cf_title], $member[mb_email], $email, $subject, $content, 1);
echo "<script> document.all.cont.innerHTML += '$cnt. $email ($mb_id : $name)<br>'; </script>\n";
//echo "+";
flush();
ob_flush();
ob_end_flush();
usleep($sleepsec);
if ($cnt % $countgap == 0) {
echo "<script> document.all.cont.innerHTML += '<br>'; document.body.scrollTop += 1000; </script>\n";
}
// 화면을 지운다... 부하를 줄임
if ($cnt % $maxscreen == 0)
echo "<script> document.all.cont.innerHTML = ''; document.body.scrollTop += 1000; </script>\n";
}
}
?>
<script> document.all.cont.innerHTML += "<br><br>총 <?=number_format($cnt)?>건 발송<br><br><font color=crimson><b>[끝]</b></font>"; document.body.scrollTop += 1000; </script>
***adm/mail_test.php***
<?
$sub_menu = "200300";
include_once("./_common.php");
if (!$config[cf_email_use])
alert("환경설정에서 \'메일발송 사용\'에 체크하셔야 메일을 발송할 수 있습니다.");
include_once("$g4[path]/lib/mailer.lib.php");
auth_check($auth[$sub_menu], "w");
check_demo();
$g4[title] = "회원메일 테스트";
$name = $member[mb_name];
$nick = $member[mb_nick];
$mb_id = $member[mb_id];
$email = $member[mb_email];
$birth = $member[mb_birth];
$datetime = $member[mb_datetime];
$sql = "select ma_subject, ma_content from $g4[mail_table] where ma_id = '$ma_id' ";
$ma = sql_fetch($sql);
$subject = $ma[ma_subject];
$content = $ma[ma_content];
$content = preg_replace("/{이름}/", $name, $content);
$content = preg_replace("/{별명}/", $nick, $content);
$content = preg_replace("/{회원아이디}/", $mb_id, $content);
$content = preg_replace("/{이메일}/", $email, $content);
$content = preg_replace("/{회원가입일}/", $datetime, $content);
$content = preg_replace("/{생일}/", (int)substr($birth,4,2).'월 '.(int)substr($birth,6,2).'일', $content);
$mb_md5 = md5($member[mb_id].$member[mb_email].$member[mb_datetime]);
$content = $content . "<hr size=0><p><span style='font-size:9pt; font-familye:굴림'>▶ 더 이상 정보 수신을 원치 않으시면 [<a href='$g4[url]/$g4[bbs]/email_stop.php?mb_id=$mb_id&mb_md5=$mb_md5' target='_blank'>수신거부</a>] 해 주십시오.</span></p>";
mailer($config[cf_title], $member[mb_email], $member[mb_email], $subject, $content, 1);
alert("$member[mb_nick]($member[mb_email])님께 테스트 메일을 발송하였습니다.\\n\\n확인하여 주십시오.");
?>
%% 테스트 메일뿐만 아니라 실제 메일로 검증된 내용입니다. 죄송합니다
아래 내용들을 각 화일 에 덮어 씌우십시오(검증됨)
다시 한 번 죄송하다는 말씀 드립니다.
*** adm/mail_form.php ***
<?
$sub_menu = "200300";
include_once("./_common.php");
auth_check($auth[$sub_menu], "r");
$html_title = "회원메일";
if ($w == "u") {
$html_title .= "수정";
$readonly = " readonly";
$sql = " select * from $g4[mail_table] where ma_id = '$ma_id' ";
$ma = sql_fetch($sql);
if (!$ma[ma_id])
alert("등록된 자료가 없습니다.");
} else {
$html_title .= "입력";
}
$g4[title] = $html_title;
include_once("./admin.head.php");
?>
<table cellpadding=0 cellspacing=0 width=100%>
<form name=fmailform method=post action="./mail_update.php" onsubmit="return fmailform_check(this);">
<input type=hidden name=w value='<? echo $w ?>'>
<input type=hidden name=ma_id value='<? echo $ma[ma_id] ?>'>
<colgroup width=20% class='col1 pad1 bold right'>
<colgroup width=80% class='col2 pad2'>
<tr>
<td colspan=2 class=title align=left><img src='<?=$g4[admin_path]?>/img/icon_title.gif'> <?=$html_title?></td>
</tr>
<tr><td colspan=2 class='line1'></td></tr>
<tr class='ht'>
<td>메일 제목</td>
<td><input type=text class='ed w99' name=ma_subject value='<?=$ma[ma_subject]?>' required itemname='메일 제목'></td>
</tr>
<tr>
<td>메일 내용</td>
<td class=lh>
<?=textarea_size("ma_content")?>
<textarea id=ma_content name=ma_content rows=20 class='ed w99' required itemname='메일 내용'><?=$ma[ma_content]?></textarea>
<br>{이름} , {별명} , {회원아이디} , {이메일} , {생일} , {회원가입일}
<br>위와 같이 HTML 코드에 삽입하면 해당 내용에 맞게 변환하여 메일 발송합니다.
</td>
</tr>
<tr><td colspan=2 class='line1'></td></tr>
</table>
<p align=center>
<input type=submit class=btn1 accesskey='s' value=' 확 인 '>
</form>
<script language="javascript">
function fmailform_check(f)
{
errmsg = "";
errfld = "";
check_field(f.ma_subject, "제목을 입력하세요.");
check_field(f.ma_content, "내용을 입력하세요.");
if (errmsg != "") {
alert(errmsg);
errfld.focus();
return false;
}
return true;
}
document.fmailform.ma_subject.focus();
</script>
<?
include_once("./admin.tail.php");
?>
**adm/mail_select_list.php ********
<?
$sub_menu = "200300";
include_once("./_common.php");
auth_check($auth[$sub_menu], "r");
$html_title = "선택된 회원메일리스트";
$ma_last_option = "";
$sql_common = " from $g4[member_table] ";
$sql_where = " where (1) ";
// 회원ID ..에서 ..까지
if ($mb_id1 != 1)
$sql_where .= " and mb_id between '$mb_id1_from' and '$mb_id1_to' ";
// E-mail에 특정 단어 포함
if ($mb_email != "")
$sql_where .= " and mb_email like '%$mb_email%' ";
// 성별
if ($mb_sex != "")
$sql_where .= " and mb_sex = '$mb_sex' ";
// 생일
if ($mb_birth_from && $mb_birth_to)
$sql_where .= " and substring(mb_birth,5,4) between '$mb_birth_from' and '$mb_birth_to' ";
// 지역
if ($mb_area != "")
$sql_where .= " and mb_addr1 like '$mb_area%' ";
// 메일링
if ($mb_mailling != "")
$sql_where .= " and mb_mailling = '$mb_mailling' ";
// 권한
$sql_where .= " and mb_level between '$mb_level_from' and '$mb_level_to' ";
// 게시판그룹회원
if ($gr_id)
{
$group_member = "";
$comma = "";
$sql2 = " select mb_id from $g4[group_member_table] where gr_id = '$gr_id' order by mb_id ";
$result2 = sql_query($sql2);
for ($k=0; $row2=sql_fetch_array($result2); $k++)
{
$group_member .= "{$comma}'$row2[mb_id]'";
$comma = ",";
}
$sql_where .= " and mb_id in ($group_member) ";
}
// 탈퇴, 차단된 회원은 제외
$sql_where .= " and mb_leave_date = '' and mb_intercept_date = '' ";
$sql = " select COUNT(*) as cnt $sql_common $sql_where ";
$row = sql_fetch($sql);
$cnt = $row[cnt];
if ($cnt == 0)
alert("선택하신 내용으로는 해당되는 회원자료가 없습니다.");
// 마지막 옵션을 저장합니다.
$ma_last_option .= "mb_id1=$mb_id1";
$ma_last_option .= "||mb_id1_from=$mb_id1_from";
$ma_last_option .= "||mb_id1_to=$mb_id1_to";
$ma_last_option .= "||mb_email=$mb_email";
$ma_last_option .= "||mb_sex=$mb_sex";
$ma_last_option .= "||mb_birth_from=$mb_birth_from";
$ma_last_option .= "||mb_birth_to=$mb_birth_to";
$ma_last_option .= "||mb_area=$mb_area";
$ma_last_option .= "||mb_mailling=$mb_mailling";
$ma_last_option .= "||mb_level_from=$mb_level_from";
$ma_last_option .= "||mb_level_to=$mb_level_to";
$ma_last_option .= "||gr_id=$gr_id";
sql_query(" update $g4[mail_table] set ma_last_option = '$ma_last_option' where ma_id = '$ma_id' ");
include_once("./admin.head.php");
?>
<table width=500 align=center><tr><td>
<?//=subtitle_bar($html_title)?><p>
<div align=right>선택된 회원수 : <?=number_format($cnt)?> 명</div>
<table cellpadding=4 cellspacing=1 width=100% class=tablebg>
<form name=fmailselectlist method=post action="javascript:fmailselectlist_submit(document.fmailselectlist);">
<input type="hidden" name="ma_id" value="<? echo $ma_id ?>">
<tr>
<td align=center>
<select size=25 name='list' style='width:500px;'>
<option>번호 . 회원아이디 / 이름 / 별명 / 생일 / E-mail / 회원가입일
<?
$sql = " select mb_id, mb_name, mb_nick, mb_email, mb_birth, mb_datetime $sql_common $sql_where order by mb_id ";
$result = sql_query($sql);
$i=0;
$ma_list = "";
$cr = "";
while ($row=sql_fetch_array($result)) {
$i++;
echo "<option>$i . $row[mb_id] / $row[mb_name] / $row[mb_nick] / $row[mb_birth] / $row[mb_email] / $row[mb_datetime]";
$ma_list .= $cr . $row[mb_email] . "||" . $row[mb_id] . "||" . $row[mb_name] . "||" . $row[mb_nick] . "||" . $row[mb_birth] . "||" . $row[mb_datetime];
$cr = "\n";
}
?>
</select>
<textarea name="ma_list" style="display:none"><?=$ma_list?></textarea>
</td>
</tr>
</table>
<p align=center>
<input type=submit class=btn1 value=' 메일 보내기 '>
<input type=button class=btn1 value=' 뒤 로 ' onclick="history.go(-1);">
</form>
</td></tr></table>
<script language='javascript'>
function fmailselectlist_submit(f)
{
f.action = "./mail_select_update.php";
f.submit();
}
</script>
<?
include_once("./admin.tail.php");
?>
****adm/mail_select_update.php *******
<?
$sub_menu = "200300";
include_once("./_common.php");
auth_check($auth[$sub_menu], "w");
$html_title = "회원메일 발송";
check_demo();
include_once("./admin.head.php");
include_once("$g4[path]/lib/mailer.lib.php");
$countgap = 10; // 몇건씩 보낼지 설정
$maxscreen = 500; // 몇건씩 화면에 보여줄건지?
$sleepsec = 200; // 천분의 몇초간 쉴지 설정
echo "<span style='font-size:9pt;'>";
echo "<p>메일 발송중 ...<p><font color=crimson><b>[끝]</b></font> 이라는 단어가 나오기 전에는 중간에 중지하지 마세요.<p>";
echo "</span>";
?>
<span id="cont"></span>
<?
include_once("./admin.tail.php");
?>
<?
flush();
ob_flush();
$ma_id = trim($_POST[ma_id]);
$select_member_list = addslashes(trim($_POST[ma_list]));
//print_r2($_POST); EXIT;
$member_list = explode("\n", $select_member_list);
// 메일내용 가져오기
$sql = "select ma_subject, ma_content from $g4[mail_table] where ma_id = '$ma_id' ";
$ma = sql_fetch($sql);
$subject = $ma[ma_subject];
$cnt = 0;
for ($i=0; $i<count($member_list); $i++) {
list($email, $mb_id, $name, $nick, $birth, $mb_datetime) = explode("||", trim($member_list[$i]));
$sw = ereg("[0-9a-zA-Z_]+(\.[0-9a-zA-Z_]+)*@[0-9a-zA-Z_]+(\.[0-9a-zA-Z_]+)*", $email);
// 올바른 메일 주소만
if ($sw == true) {
$cnt++;
$mb_md5 = md5($mb_id.$mb_email);
$content = $ma[ma_content];
$content = preg_replace("/{이름}/", $name, $content);
$content = preg_replace("/{별명}/", $nick, $content);
$content = preg_replace("/{회원아이디}/", $mb_id, $content);
$content = preg_replace("/{회원가입일}/", substr($mb_datetime,0,10), $content); //추가
$content = preg_replace("/{이메일}/", $email, $content);
$content = preg_replace("/{생일}/", (int)substr($birth,4,2).'월 '.(int)substr($birth,6,2).'일', $content);
$content = $content . "<hr size=0><p><span style='font-size:9pt; font-familye:굴림'>▶ 더 이상 정보 수신을 원치 않으시면 [<a href='$g4[url]/$g4[bbs]/email_stop.php?mb_id=$mb_id&mb_md5=$mb_md5' target='_blank'>수신거부</a>] 해 주십시오.</span></p>";
/*
ob_start();
include "$mail_skin/mail.skin.php";
$content = ob_get_contents();
ob_end_clean();
*/
//mailer($default[de_subject], $default[de_admin_email], $email, $subject, $content, 1);
mailer($config[cf_title], $member[mb_email], $email, $subject, $content, 1);
echo "<script> document.all.cont.innerHTML += '$cnt. $email ($mb_id : $name)<br>'; </script>\n";
//echo "+";
flush();
ob_flush();
ob_end_flush();
usleep($sleepsec);
if ($cnt % $countgap == 0) {
echo "<script> document.all.cont.innerHTML += '<br>'; document.body.scrollTop += 1000; </script>\n";
}
// 화면을 지운다... 부하를 줄임
if ($cnt % $maxscreen == 0)
echo "<script> document.all.cont.innerHTML = ''; document.body.scrollTop += 1000; </script>\n";
}
}
?>
<script> document.all.cont.innerHTML += "<br><br>총 <?=number_format($cnt)?>건 발송<br><br><font color=crimson><b>[끝]</b></font>"; document.body.scrollTop += 1000; </script>
***adm/mail_test.php***
<?
$sub_menu = "200300";
include_once("./_common.php");
if (!$config[cf_email_use])
alert("환경설정에서 \'메일발송 사용\'에 체크하셔야 메일을 발송할 수 있습니다.");
include_once("$g4[path]/lib/mailer.lib.php");
auth_check($auth[$sub_menu], "w");
check_demo();
$g4[title] = "회원메일 테스트";
$name = $member[mb_name];
$nick = $member[mb_nick];
$mb_id = $member[mb_id];
$email = $member[mb_email];
$birth = $member[mb_birth];
$datetime = $member[mb_datetime];
$sql = "select ma_subject, ma_content from $g4[mail_table] where ma_id = '$ma_id' ";
$ma = sql_fetch($sql);
$subject = $ma[ma_subject];
$content = $ma[ma_content];
$content = preg_replace("/{이름}/", $name, $content);
$content = preg_replace("/{별명}/", $nick, $content);
$content = preg_replace("/{회원아이디}/", $mb_id, $content);
$content = preg_replace("/{이메일}/", $email, $content);
$content = preg_replace("/{회원가입일}/", $datetime, $content);
$content = preg_replace("/{생일}/", (int)substr($birth,4,2).'월 '.(int)substr($birth,6,2).'일', $content);
$mb_md5 = md5($member[mb_id].$member[mb_email].$member[mb_datetime]);
$content = $content . "<hr size=0><p><span style='font-size:9pt; font-familye:굴림'>▶ 더 이상 정보 수신을 원치 않으시면 [<a href='$g4[url]/$g4[bbs]/email_stop.php?mb_id=$mb_id&mb_md5=$mb_md5' target='_blank'>수신거부</a>] 해 주십시오.</span></p>";
mailer($config[cf_title], $member[mb_email], $member[mb_email], $subject, $content, 1);
alert("$member[mb_nick]($member[mb_email])님께 테스트 메일을 발송하였습니다.\\n\\n확인하여 주십시오.");
?>
%% 테스트 메일뿐만 아니라 실제 메일로 검증된 내용입니다. 죄송합니다
네잎클로버님 최고~! 좋은 팁 감사합니다. ^0^
아..감사합니다..
이렇게 긴내용을 ..초보임을 감안하시어..친절하게^^;;
정말 감사드립니다.
적용해보았떠니..너무잘됩니다..
세심하게 신경써주셔서 정말 감사드립니다..
이렇게 긴내용을 ..초보임을 감안하시어..친절하게^^;;
정말 감사드립니다.
적용해보았떠니..너무잘됩니다..
세심하게 신경써주셔서 정말 감사드립니다..