發表回覆建立主題發起投票

> 電子報模組更新, 後台電子報模組程式更新檔
oldpa
發表於: 2012-08-06, 10:50 AM
引用文章


超級會員
*****

所屬群組: 管理群組
發表總數: 5402
會員編號: 1
註冊日期: --



檔案分為FCK與HTMLAREA兩個不同所見即所得編輯器
請依需求下載

後台電子報模組程式更新檔
已分批寄送方式完成整個流程
防止瀏覽器網頁中斷

TWE2.1~3.02版本皆可使用

下載位置
http://www.twecommerce.org/modules/wmpdown...?cid=48&lid=176

解壓縮後覆蓋
admin/module_newsletter.php
請先備份

PS:
開啟檔案module_newsletter.php
找出
CODE

define('NEWSLETTER_EXECUTE_LIMIT', '10');

代表一個reload送出郵件數


找出
CODE

   $ajax = '<script language="javascript" type="text/javascript">setTimeout("document.newsletter_send.submit()",1000);</script>';


其中1000代表一秒鐘網頁reload一次,如更改成5000則5秒鍾執行一次

在寄信過程中可以隨時中斷程式
也可以加入過濾某些網欲的郵件寄送
例如找出
CODE

for ($i=1;$i<=NEWSLETTER_EXECUTE_LIMIT;$i++) {
 // mail
       if(!empty($email_data[$i-1])) {
 twe_php_mail(EMAIL_SUPPORT_ADDRESS,
              EMAIL_SUPPORT_NAME,
              $email_data[$i-1]['email'] ,
              $email_data[$i-1]['lastname'] . ' ' . $email_data[$i-1]['firstname'] ,
              '',
              EMAIL_SUPPORT_REPLY_ADDRESS,
              EMAIL_SUPPORT_REPLY_ADDRESS_NAME,
               '',
               '',
               $newsletters_data->fields['title'],
               $newsletters_data->fields['body'] ,
               $newsletters_data->fields['body']);
 $db->Execute("UPDATE module_newsletter_temp_".(int)$_GET['ID']." SET comment='send' WHERE id='".$email_data[$i-1]['id']."'");
 //echo twe_image(DIR_WS_ICONS . 'tick.gif', $email_data[$i-1]['email']).$email_data[$i-1]['email'];
  }
}


在寄信的動作前再做一次判斷
加入
CODE

if(!empty($email_data[$i-1])) {
if (!preg_match('~@(yahoo\.com\.tw|pchome\.com\.tw)$~', $email_data[$i-1]['email'])){
twe_php_mail(EMAIL_SUPPORT_ADDRESS,
........
.......
}

成為下列:
CODE

for ($i=1;$i<=NEWSLETTER_EXECUTE_LIMIT;$i++) {
 // mail
       if(!empty($email_data[$i-1])) {
if (!preg_match('~@(yahoo\.com\.tw|pchome\.com\.tw)$~', $email_data[$i-1]['email'])){
 twe_php_mail(EMAIL_SUPPORT_ADDRESS,
              EMAIL_SUPPORT_NAME,
              $email_data[$i-1]['email'] ,
              $email_data[$i-1]['lastname'] . ' ' . $email_data[$i-1]['firstname'] ,
              '',
              EMAIL_SUPPORT_REPLY_ADDRESS,
              EMAIL_SUPPORT_REPLY_ADDRESS_NAME,
               '',
               '',
               $newsletters_data->fields['title'],
               $newsletters_data->fields['body'] ,
               $newsletters_data->fields['body']);
 $db->Execute("UPDATE module_newsletter_temp_".(int)$_GET['ID']." SET comment='send' WHERE id='".$email_data[$i-1]['id']."'");
 echo twe_image(DIR_WS_ICONS . 'tick.gif', $email_data[$i-1]['email']).$email_data[$i-1]['email'];
  }
 }
}

如此將過濾掉
yahoo.com.tw
pchome.com.tw

同樣的方式也可以用來修改會員註冊
使用此二個網域的EMAIL不允許註冊使用

這樣的方式會將以後所有的電子報將
yahoo.com.tw
pchome.com.tw
排除

如果要依不同電子報來排除
可以修改找出

CODE

$sql_data_array=array(
                              'customers_id'=>$customers_data->fields['customers_id'],
                              'customers_status'=>$groups[$i],
                              'customers_firstname'=>$customers_data->fields['customers_firstname'],
                              'customers_lastname'=>$customers_data->fields['customers_lastname'],
                              'customers_email_address'=>$customers_data->fields['customers_email_address'],
                              'date'=>'now()');


  twe_db_perform('module_newsletter_temp_'.$id, $sql_data_array);

更改為
CODE

if (!preg_match('~@(yahoo\.com\.tw|pchome\.com\.tw)$~', $customers_data->fields['customers_email_address'])){
.$sql_data_array=array(
                              'customers_id'=>$customers_data->fields['customers_id'],
                              'customers_status'=>$groups[$i],
                              'customers_firstname'=>$customers_data->fields['customers_firstname'],
                              'customers_lastname'=>$customers_data->fields['customers_lastname'],
                              'customers_email_address'=>$customers_data->fields['customers_email_address'],
                              'date'=>'now()');
  twe_db_perform('module_newsletter_temp_'.$id, $sql_data_array);
}

如此將再編輯或新增該電子報時
才過濾掉
yahoo.com.tw
pchome.com.tw


--------------------

傳送簡訊個人網站
Top
0 位使用者正在閱讀本主題 (0 位訪客及 0 位匿名使用者)
0 位會員:

主題選項 發表回覆建立主題發起投票