《CMS技巧:phpcms v9 郵件群發(fā)實(shí)現(xiàn)方法》要點(diǎn):
本文介紹了CMS技巧:phpcms v9 郵件群發(fā)實(shí)現(xiàn)方法,希望對(duì)您有用。如果有疑問,可以聯(lián)系我們。
相關(guān)主題:PHPCMS教程
導(dǎo)讀:自己的網(wǎng)站維易
PHP培訓(xùn)網(wǎng),看到很多注冊(cè)會(huì)員后沒有郵箱驗(yàn)證,但是會(huì)員比較多,一個(gè)一個(gè)發(fā)送郵件很煩,于是就自己二次開發(fā)了一個(gè)郵件群發(fā)功能,現(xiàn)
自己的網(wǎng)站維易PHP培訓(xùn)網(wǎng),看到很多注冊(cè)會(huì)員后沒有郵箱驗(yàn)證,但是會(huì)員比較多,一個(gè)一個(gè)發(fā)送郵件很煩,于是就自己二次開發(fā)了一個(gè)郵件群發(fā)功能,現(xiàn)在分享給大家.記得收藏哦!
phpcms v9郵件群發(fā)功能是在 ? ?用戶=》會(huì)員管理 ? ?里面實(shí)現(xiàn)的,選中要發(fā)送的會(huì)員,然后郵件群發(fā)就行了,如圖:

下面是實(shí)現(xiàn)步驟:
1.找到phpcms v9里面phpcms/modules/member/templates/member_list.tpl.php 在97行后面添加?
代碼如下:
<input type="button" class="button" name="dosubmit" onclick="emails();return false" value="發(fā)送郵件" />
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:'<?php echo L('plsease_select').L('member')?>',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');
??? }
???
?
}
效果圖如下:

如果還有不會(huì)的請(qǐng)聯(lián)系QQ:634381967轉(zhuǎn)載請(qǐng)注明本頁網(wǎng)址:
http://www.fzlkiss.com/jiaocheng/6041.html