emlog评论邮件通知-美化篇

  • 内容
  • 相关

复制以下代码覆盖修改至kl_sendmail.php文件即可。

1.jpg

<?php
/*
Plugin Name: Sendmail
Version: 3.8
Plugin URL: http://kller.cn/?post=61
Description: 发送博客留言至E-mail。
Author: KLLER
Author Email: kller@foxmail.com
Author URL: http://kller.cn
*/
 
!defined('EMLOG_ROOT') && exit('access deined!');
require_once(EMLOG_ROOT.'/content/plugins/kl_sendmail/class/class.smtp.php');
require_once(EMLOG_ROOT.'/content/plugins/kl_sendmail/class/class.phpmailer.php');
function kl_sendmail_do($mailserver, $port, $mailuser, $mailpass, $mailto, $subject,  $content, $fromname)
{
$mail = new KL_SENDMAIL_PHPMailer();
$mail->CharSet = "UTF-8";
$mail->Encoding = "base64";
$mail->Port = $port;
 
if(KL_MAIL_SENDTYPE == 1)
{
$mail->IsSMTP();
}else{
$mail->IsMail();
}
$mail->Host = $mailserver;
$mail->SMTPAuth = true;
$mail->Username = $mailuser;
$mail->Password = $mailpass;
 
$mail->From = $mailuser;
$mail->FromName = $fromname;
 
$mail->AddAddress($mailto);
$mail->WordWrap = 500;
$mail->IsHTML(true);
$mail->Subject = $subject;
$mail->Body = $content;
$mail->AltBody = "This is the body in plain text for non-HTML mail clients";
if($mail->Host == 'smtp.gmail.com') $mail->SMTPSecure = "ssl";
if(!$mail->Send())
{
echo $mail->ErrorInfo;
return false;
}else{
return true;
}
}
function kl_sendmail_get_comment_mail()
{
include(EMLOG_ROOT.'/content/plugins/kl_sendmail/kl_sendmail_config.php');
if(KL_IS_SEND_MAIL == 'Y' || KL_IS_REPLY_MAIL == 'Y')
{
$comname = isset($_POST['comname']) ? addslashes(trim($_POST['comname'])) : '';
$comment = isset($_POST['comment']) ? addslashes(trim($_POST['comment'])) : '';
$commail = isset($_POST['commail']) ? addslashes(trim($_POST['commail'])) : '';
$comurl = isset($_POST['comurl']) ? addslashes(trim($_POST['comurl'])) : '';
$gid = isset($_POST['gid']) ? intval($_POST['gid']) : (isset($_GET['gid']) ? intval($_GET['gid']) : -1);
$pid = isset($_POST['pid']) ? intval($_POST['pid']) : 0;
$http_referer = empty($_SERVER['HTTP_REFERER']) ? BLOG_URL : $_SERVER['HTTP_REFERER'];
 
$blogname = Option::get('blogname');
$Log_Model = new Log_Model();
$logData = $Log_Model->getOneLogForHome($gid);
$log_title = $logData['log_title'];
$subject = "日志《{$log_title}》收到了新的评论";
if(strpos(KL_MAIL_TOEMAIL, '@139.com') === false)
{
$content = "评论内容:{$comment}<br /><br />发件人:".$comname."<br />";
if(!empty($commail)) $content .= "Email:{$commail}<br />";
if(!empty($comurl)) $content .= "主页:{$comurl}<br />";
$content .= "<br /><strong>=> 现在就前往<a href=\"{$http_referer}\" target=\"_blank\">日志页面</a>进行查看</strong><br />";
}else{
$content = $comment;
}
if(KL_IS_SEND_MAIL == 'Y')
{
if(ROLE == 'visitor') kl_sendmail_do(KL_MAIL_SMTP, KL_MAIL_PORT, KL_MAIL_SENDEMAIL, KL_MAIL_PASSWORD, KL_MAIL_TOEMAIL, $subject, $content, $blogname);
}
if(KL_IS_REPLY_MAIL == 'Y')
{
if($pid > 0)
{
$DB = Option::EMLOG_VERSION >= '5.3.0' ? Database::getInstance() : MySql::getInstance();
$Comment_Model = new Comment_Model();
$pinfo = $Comment_Model->getOneComment($pid);
if(!empty($pinfo['mail']))
{
$subject = "您在【{$blogname}】发表的评论收到了回复";
$content ='
               <div align="center" style="font: 13px/1.5 microsoft yahei,Verdana,Arial,Helvetica,sans-serif;">
               <br/><br/>
               <div align="left" style="text-decoration:none;width:580px;font-size:14px;padding:10px 15px;margin-bottom:20px;border:1px solid #ccc;border-radius:4px;">
               <div align="center"><strong><span style="font-size:28px;color:#08d;">懒人的小窝</span></strong></div>
               <p><strong>'.$pinfo['poster'].'</strong> , 您好:</p>
               <p><strong>&nbsp;&nbsp;&nbsp;&nbsp;您之前在 《'.$log_title.'》 发表的的评论:</strong></p>
               <p>&nbsp;&nbsp;&nbsp;&nbsp;'.$pinfo['comment'].'</p>
               <p><strong>'.$comname.'</strong> 给您的回复:</p>
               <p>&nbsp;&nbsp;&nbsp;&nbsp;'.$comment.'</p>
               <p><strong>您可以点击 <a href="'.Url::log($gid).'" style="text-decoration: none;outline:none;" target="_blank">→查看该日志←</a></strong></p>
               <p><strong>感谢您对 <a href="'.BLOG_URL.'" style="text-decoration: none;outline:none;" target="_blank">'.$blogname.'</a> 的关注, 欢迎 <a href="'.BLOG_URL.'rss.php" style="text-decoration: none;outline:none;" target="_blank">订阅本站</a></strong></p>
               <p style="color:#999; margin:26px 0 0 0; font-size:12px;">
               <span style="text-align:right;background:#ccc;height:1px;widli:100%;overflow:hidden;display:block;margin:8px 0;"></span>
               懒人的小窝<br>
               '.gmdate("Y年 m月 d日",time()+8*3600).'
               </p>
               </div>
               <p>Powered by <a href="http://suppore.cn" style="text-decoration: none;outline:none;" target="_blank" title="懒人的小窝">懒人的小窝</a></p>
               <br/>
               </div>';
kl_sendmail_do(KL_MAIL_SMTP, KL_MAIL_PORT, KL_MAIL_SENDEMAIL, KL_MAIL_PASSWORD, $pinfo['mail'], $subject, $content, $blogname);
}
}
}
}else{
return;
}
}
addAction('comment_saved', 'kl_sendmail_get_comment_mail');
 
function kl_sendmail_get_twitter_mail($r, $name, $date, $tid)
{
include(EMLOG_ROOT.'/content/plugins/kl_sendmail/kl_sendmail_config.php');
if(KL_IS_TWITTER_MAIL == 'Y')
{
$DB = Option::EMLOG_VERSION >= '5.3.0' ? Database::getInstance() : MySql::getInstance();
$blogname = Option::get('blogname');
$sql = "select a.content, b.username from ".DB_PREFIX."twitter a left join ".DB_PREFIX."user b on b.uid=a.author where a.id={$tid}";
$res = $DB->query($sql);
$row = $DB->fetch_array($res);
$author = $row['username'];
$twitter = $row['content'];
$subject = "{$author}发布的碎语收到了新的回复";
if(strpos(KL_MAIL_TOEMAIL, '@139.com') === false)
{
$content = "{$author}发布的碎语:{$twitter}<br /><br />{$name}对碎语的回复:{$r}<br /><br /><strong>=> 现在就前往<a href=\"{$_SERVER['HTTP_REFERER']}\" target=\"_blank\">碎语页面</a>进行查看</strong><br />";
}else{
$content = $r;
}
if(ROLE == 'visitor') kl_sendmail_do(KL_MAIL_SMTP, KL_MAIL_PORT, KL_MAIL_SENDEMAIL, KL_MAIL_PASSWORD, KL_MAIL_TOEMAIL, $subject, $content, $blogname);
}
}
addAction('reply_twitter', 'kl_sendmail_get_twitter_mail');
 
function kl_sendmail_put_reply_mail($commentId, $reply)
{
global $userData;
include(EMLOG_ROOT.'/content/plugins/kl_sendmail/kl_sendmail_config.php');
if(KL_IS_REPLY_MAIL == 'Y')
{
$DB = Option::EMLOG_VERSION >= '5.3.0' ? Database::getInstance() : MySql::getInstance();
$blogname = Option::get('blogname');
$Comment_Model = new Comment_Model();
$commentArray = $Comment_Model->getOneComment($commentId);
extract($commentArray);
$subject="您在【{$blogname}】发表的评论收到了回复";
if(strpos($mail, '@139.com') === false)
{
$emBlog = new Log_Model();
$logData = $emBlog->getOneLogForHome($gid);
$log_title = $logData['log_title'];
$content =  '
<div align="center" style="font: 13px/1.5 microsoft yahei,Verdana,Arial,Helvetica,sans-serif;">
               <br/><br/>
               <div align="left" style="text-decoration:none;width:580px;font-size:14px;padding:10px 15px;margin-bottom:20px;border:1px solid #ccc;border-radius:4px;">
               <div align="center"><strong><span style="font-size:28px;color:#08d;">懒人的小窝</span></strong></div>
               <p><strong>'.$poster.'</strong> ,您好:</p>
               <p><strong>&nbsp;&nbsp;&nbsp;&nbsp;您之前在 《'.$log_title.'》 发表的的评论:</strong></p>
               <p>&nbsp;&nbsp;&nbsp;&nbsp;'.$comment.'</p>
               <p><strong>'.$userData['nickname'].'</strong> 给您的回复:</p>
               <p>&nbsp;&nbsp;&nbsp;&nbsp;'.$reply.'</p>
               <p><strong>您可以点击 <a href="'.Url::log($gid).'" style="text-decoration: none;outline:none;" target="_blank">查看该日志</a></strong></p>
               <p><strong>感谢您对 <a href="'.BLOG_URL.'" style="text-decoration: none;outline:none;" target="_blank">'.$blogname.'</a> 的关注, 欢迎 <a href="'.BLOG_URL.'rss.php" style="text-decoration: none;outline:none;" target="_blank">订阅本站</a></strong></p>
               <p style="color:#999; margin:26px 0 0 0; font-size:12px;">
               懒人的小窝:<a href="http://suppore.cn" target="_blank" style="color:#999;">http://suppore.cn</a><br>
               <span style="text-align:right;background:#ccc;height:1px;widli:100%;overflow:hidden;display:block;margin:8px 0;"></span>
               懒人的小窝<br>
               '.gmdate("Y年 m月 d日",time()+8*3600).'
               </p>
               </div>
               <p>Powered by <a href="http://suppore.cn" style="text-decoration: none;outline:none;" target="_blank" title="懒人的小窝">懒人的小窝</a></p>
               <br/>
               </div>';
}else{
$content = $reply;
}
if($mail != '')	kl_sendmail_do(KL_MAIL_SMTP, KL_MAIL_PORT, KL_MAIL_SENDEMAIL, KL_MAIL_PASSWORD, $mail, $subject, $content, $blogname);
}else{
return;
}
}
addAction('comment_reply', 'kl_sendmail_put_reply_mail');
 
function kl_sendmail_menu()
{
echo '<div class="sidebarsubmenu" id="kl_sendmail"><a href="./plugin.php?plugin=kl_sendmail">邮件通知</a></div>';
}
addAction('adm_sidebar_ext', 'kl_sendmail_menu');
?>
kl_sendmail.php大小: | 来源:本地下载
已经过安全软件检测无毒,请您放心下载。
emlog评论邮件通知-美化篇
         本页正文内容约8626个文字
         本文标签:

         版权声明:若无特殊注明,本文皆为“懒人的小窝”原创,转载请保留文章出处。

         本文链接:https://suppore.cn/em_email.html   百度已收录

发表评论

电子邮件地址不会被公开, 推荐使用QQ快速评论!

评论

3条评论
  1. avatar

    游客 Lv.1 Chrome 52.0.2743.116 Chrome 52.0.2743.116 Windows Windows 回复

    测试一下

    四川省 广电网

    1. avatar

      李明 Lv.2 Firefox 47.0 Firefox 47.0 Android 5.1.1 Android 5.1.1 回复

      不错,收藏了,谢谢!

      香港 特别行政区

      1. 小陈 Lv.6 Chrome 52.0.2743.116 Chrome 52.0.2743.116 Windows Windows 回复

        回复了李明:莎哇蒂卡。

              北京市 北京融合通达网络科技有限公司联通节点

    00:00 / 00:00
    顺序播放