自己的網站B5教程網,看到很多注冊會員后沒有郵箱驗證,但是會員比較多,一個一個發(fā)送郵件很煩,于是就自己二次開發(fā)了一個郵件群發(fā)功能,現在分享給大家。記得收藏哦!
phpcms v9郵件群發(fā)功能是在 用戶=》會員管理 里面實現的,選中要發(fā)送的會員,然后郵件群發(fā)就行了,如圖:
下面是實現步驟:
1.找到phpcms v9里面phpcms/modules/member/templates/member_list.tpl.php 在97行后面添加
2.在member_list.tpl.php的頁面里添加一段js代碼
function emails()
{
var ids='';
$("input[name='userid[]']:checked").each(function(i, n){
ids += $(n).val() + ',';
});
if(ids=='') {
window.top.art.dialog({content:'',lock:true,width:'200',height:'50',time:1.5},function(){});
return false;
}
window.top.art.dialog({id:'emails'}).close();
window.top.art.dialog({title:'發(fā)送郵件',id:'emails',iframe:'?m=member&c=member&a=emails&ids='+ids,width:'700',height:'400'}, function(){var d = window.top.art.dialog({id:'emails'}).data.iframe;d.$('#dosubmit').click();return false;}, function(){window.top.art.dialog({id:'emails'}).close()});
}
3.找到phpcms/modules/member/member.php添加下面代碼:
/**
* 群發(fā)郵件
*/
function emails()
{
if(isset($_POST['dosubmit'])) {
pc_base::load_sys_func('mail');
$ids = isset($_POST['emails']['ids']) ? explode(',', $_POST['emails']['ids']): showmessage(L('illegal_parameters'), HTTP_REFERER);
array_pop($ids);
if(!empty($ids)) {
$where = to_sqls($ids, '', 'userid');
$userarr = $this->db->listinfo($where);
$emailetitle=$_POST['emails']['title']." - www.bcty365.com";
$emailcontent=$_POST['emails']['content'];
foreach($userarr as $k =>$v)
{
sendmail($v['email'],$emailetitle,$emailcontent);
}
showmessage("郵件發(fā)送成功", HTTP_REFERER, '2000', 'emails');
} else {
showmessage(L('illegal_parameters'), HTTP_REFERER, '', 'emails');
}
}else
{
$ids =$_GET['ids'];
include $this->admin_tpl('member_email');
}
}
效果圖如下:
本文地址:
申請創(chuàng)業(yè)報道,分享創(chuàng)業(yè)好點子。點擊此處,共同探討創(chuàng)業(yè)新機遇!