function doCommentEmail($fid=0, $aid=0, $msg='', $doType='reply'){
global $dsql, $cfg_adminemail, $cfg_sendmail_bysmtp, $cfg_smtp_server, $cfg_smtp_port, $cfg_smtp_usermail, $cfg_smtp_password, $cfg_webname, $cfg_basehost;
$arcRow = GetOneArchive($aid);
$headers = "From: ".$cfg_adminemail." Reply-To: ".$cfg_adminemail;
if($doType == 'reply'){
$query = "SELECT f.*,m.uname,m.email FROM dede_feedback f LEFT JOIN dede_member m on f.mid = m.mid WHERE f.id = '{$fid}' AND mid > 0";
$row = $dsql->GetOne($query);
if(!is_array($row)) return '';
$email = $row['email'];
$mailtitle = "您在『{$cfg_webname}』的评论已被回复";
$mailbody = "{$row['uname']},您好: 您在{$cfg_webname}的评论已被人回复!<pre>{$msg}</pre><br/><a href='{$arcRow['arcurl']}'>点击这里查看详情</a>";
}else{
$email = $cfg_adminemail;
$mailtitle = "您的网站『{$cfg_webname}』有新的评论";
$mailbody = "网站管理员,您好:<br/> 您的网站《{$cfg_webname}》有新的评论!<pre>{$msg}</pre><br/><a href='{$cfg_basehost}'>点击这里查看详情</a>";
}
if($email == '') return '';
if($cfg_sendmail_bysmtp == 'Y' && !emptyempty($cfg_smtp_server))
{
$mailtype = 'HTML';
require_once(DEDEINC.'/mail.class.php');
$smtp = new smtp($cfg_smtp_server,$cfg_smtp_port,true,$cfg_smtp_usermail,$cfg_smtp_password); $smtp->debug = false;
$smtp->sendmail($email,$cfg_webname ,$cfg_smtp_usermail, $mailtitle, $mailbody, $mailtype);
}
else
{
@mail($email, $mailtitle, $mailbody, $headers);
}}
|