自己的網(wǎng)站B5教程網(wǎng),看到很多注冊會員后沒有郵箱驗(yàn)證,但是會員比較多,一個(gè)一個(gè)發(fā)送郵件很煩,于是就自己二次開發(fā)了一個(gè)郵件群發(fā)功能,現(xiàn)在分享給大家。記得收藏哦!
phpcms v9郵件群發(fā)功能是在 用戶=》會員管理 里面實(shí)現(xiàn)的,選中要發(fā)送的會員,然后郵件群發(fā)就行了,如圖:
下面是實(shí)現(xiàn)步驟:
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è)報(bào)道,分享創(chuàng)業(yè)好點(diǎn)子。點(diǎn)擊此處,共同探討創(chuàng)業(yè)新機(jī)遇!