<?
$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];

$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("/{会员id}/", $mb_id, $content);
$content = preg_replace("/{邮件地址}/", $email, $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请确认");
?>
