[問題]HTML會員電子報

phpBB 2 MOD Support
無論是官方或非官方認證之外掛,安裝與使用問題討論。
(發表文章請按照公告格式發表,違者砍文)

版主: 版主管理群

aaron
星球公民
星球公民
文章: 37
註冊時間: 2002-05-29 01:51
聯繫:

[問題]HTML會員電子報

文章 aaron »

問題外掛:PHPBB發HTML信件
參考連結: http://phpbb-tw.net/phpbb/viewtopic.php?t=16363
使用版本:phpBB 2.0.6
網站位置:http://design.mwimg.com
狀況描述:

之前2.04安裝此模組正常
但升級成2.06之後
發現相關要改的檔案內容有些變動
請高手可以幫忙一下
怎樣讓2.06也可以發送HTML格式信件
謝謝
aaron
星球公民
星球公民
文章: 37
註冊時間: 2002-05-29 01:51
聯繫:

文章 aaron »

之前2.04版本發行電子報都是HTML
現在無法解決的話\r
要改用文字報了...^^
davidcool
星球公民
星球公民
文章: 189
註冊時間: 2003-01-31 15:06
來自: Taipei, Taiwan

文章 davidcool »

如果2.0.6不能發的話(我不知道,我沒裝2.0.6)
那網路上有很多發電子報的
例如PCHome, Yahoo, Maillist........

個人推薦是用Maillist
http://www.maillist.com.tw/
速度有點慢就是了(他寫CGI的=_=!!!)

其實我也沒裝這MOD :oops:
bu
版面管理員
版面管理員
文章: 443
註冊時間: 2003-02-23 12:46
來自: 25° 4′N 121° 29′E
聯繫:

文章 bu »

davidcool 寫:如果2.0.6不能發的話(我不知道,我沒裝2.0.6)
那網路上有很多發電子報的
例如PCHome, Yahoo, Maillist........

個人推薦是用Maillist
http://www.maillist.com.tw/
速度有點慢就是了(他寫CGI的=_=!!!)

其實我也沒裝這MOD :oops:
如果用那些....發 HTML 格式會有廣告吧 ^^"
*譯文資料在phpBB 技術文件
bu.femto-size
*和我聯絡,請寄 or Google Talk 圖檔
*作品: Intergrated Toplist & Message Can
aaron
星球公民
星球公民
文章: 37
註冊時間: 2002-05-29 01:51
聯繫:

文章 aaron »

我的電子報紙是很單純的發給會員\r
PHPBB後台就很好用\r
不用另外的訂報機制\r

所以我還是希望能夠解決這個問題...^^
aaron
星球公民
星球公民
文章: 37
註冊時間: 2002-05-29 01:51
聯繫:

文章 aaron »

看來用2.06的人還不多吧... :oops:
yuankuei
星球普通子民
星球普通子民
文章: 23
註冊時間: 2003-07-24 04:21
來自: CA 91801
聯繫:

文章 yuankuei »

對照了一下 MOD 內容和 2.0.6 版的 php 檔案
大概要在 /includes/emailer.php 裡面修改\r
原本要改的地方是\r

代碼: 選擇全部

尋找 
// 
// Sets an email address to send to 
// 
function email_address($address) 
{ 
$this->address = ''; 
$this->address .= $address; 
} 


在下方加上 
// 
// Sets an email Content type 
// 
function mail_type($mail_type) 
{ 
$this->mail_type = $mail_type; 
} 



尋找 
$universal_extra = "MIME-Version: 1.0
Content-type: text/plain; charset=" . $this->encoding . "
Content-transfer-encoding: 8bit
Date: " . gmdate('D, d M Y H:i: s', time()) . " UT
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: PHP
"; 

替換成 
$universal_extra = "MIME-Version: 1.0
Content-type: " . $this->mail_type . "; charset=" . $this->encoding . "
Content-transfer-encoding: 8bit
Date: " . gmdate('D, d M Y H:i: s', time()) . " UT
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: PHP
"; 
改成下列程式碼\r

代碼: 選擇全部

尋找 
// Sets an email address to send to
	function email_address($address)
	{
		$this->addresses['to'] = trim($address);
	}

在下方加上 
// Sets an email Content type 
	function mail_type($mail_type) 
	{ 
		$this->mail_type = trim($mail_type); 
	} 


尋找 
$this->extra_headers = (($this->reply_to != '') ? "Reply-to: $this->reply_to
" : '') . (($this->from != '') ? "From: $this->from
" : "From: " . $board_config['board_email'] . "
") . "Return-Path: " . $board_config['board_email'] . "
Message-ID: <" . md5(uniqid(time())) . "@" . $board_config['server_name'] . ">
MIME-Version: 1.0
Content-type: text/plain; charset=" . $this->encoding . "
Content-transfer-encoding: 8bit
Date: " . date('r', time()) . "
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: PHP
X-MimeOLE: Produced By phpBB2
" . $this->extra_headers . (($cc != '') ? "Cc: $cc
" : '')  . (($bcc != '') ? "Bcc: $bcc
" : ''); 

替換成 
$this->extra_headers = (($this->reply_to != '') ? "Reply-to: $this->reply_to
" : '') . (($this->from != '') ? "From: $this->from
" : "From: " . $board_config['board_email'] . "
") . "Return-Path: " . $board_config['board_email'] . "
Message-ID: <" . md5(uniqid(time())) . "@" . $board_config['server_name'] . ">
MIME-Version: 1.0
[color=red]Content-type: " . $this->mail_type .";[/color] charset=" . $this->encoding . "
Content-transfer-encoding: 8bit
Date: " . date('r', time()) . "
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: PHP
X-MimeOLE: Produced By phpBB2
" . $this->extra_headers . (($cc != '') ? "Cc: $cc
" : '')  . (($bcc != '') ? "Bcc: $bcc
" : ''); 
大致上應該是這樣\r
我試著裝上之後看起來應該是沒有問題:roll:
修改的目標就是要加入 content-type 讓收信端知道這是一封 HTML 的信件
bu
版面管理員
版面管理員
文章: 443
註冊時間: 2003-02-23 12:46
來自: 25° 4′N 121° 29′E
聯繫:

文章 bu »

謝謝了...
PS.關於訂閱的事可以使用群組功能
*譯文資料在phpBB 技術文件
bu.femto-size
*和我聯絡,請寄 or Google Talk 圖檔
*作品: Intergrated Toplist & Message Can
aaron
星球公民
星球公民
文章: 37
註冊時間: 2002-05-29 01:51
聯繫:

文章 aaron »

感謝yuankuei
我馬上試試看...^^
aaron
星球公民
星球公民
文章: 37
註冊時間: 2002-05-29 01:51
聯繫:

文章 aaron »

我將兩位高手的資料整理如下,希望對使用2.06版的朋友有些幫助...


PHPBB 2.06 發HTML信件

1.打開 \admin\admin_mass_email.php

代碼: 選擇全部

尋找 
$message = stripslashes(trim($HTTP_POST_VARS['message'])); 

在下方加上 
$mail_type = stripslashes(trim($HTTP_POST_VARS['mail_type'])); 
圖檔

代碼: 選擇全部

尋找 
$emailer->extra_headers($email_headers); 

在下方加上 
$emailer->mail_type($mail_type);
圖檔

2.打開 \includes\emailer.php

代碼: 選擇全部

尋找 
// Sets an email address to send to 
   function email_address($address) 
   { 
      $this->addresses['to'] = trim($address); 
   } 

在下方加上 
// Sets an email Content type 
   function mail_type($mail_type) 
   { 
      $this->mail_type = trim($mail_type); 
   } 
圖檔

代碼: 選擇全部

尋找 
$this->extra_headers = (($this->reply_to != '') ? "Reply-to: $this->reply_to
" : '') . (($this->from != '') ? "From: $this->from
" : "From: " . $board_config['board_email'] . "
") . "Return-Path: " . $board_config['board_email'] . "
Message-ID: <" . md5(uniqid(time())) . "@" . $board_config['server_name'] . ">
MIME-Version: 1.0
Content-type: text/plain; charset=" . $this->encoding . "
Content-transfer-encoding: 8bit
Date: " . date('r', time()) . "
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: PHP
X-MimeOLE: Produced By phpBB2
" . $this->extra_headers . (($cc != '') ? "Cc: $cc
" : '')  . (($bcc != '') ? "Bcc: $bcc
" : ''); 

替換成 
$this->extra_headers = (($this->reply_to != '') ? "Reply-to: $this->reply_to
" : '') . (($this->from != '') ? "From: $this->from
" : "From: " . $board_config['board_email'] . "
") . "Return-Path: " . $board_config['board_email'] . "
Message-ID: <" . md5(uniqid(time())) . "@" . $board_config['server_name'] . ">
MIME-Version: 1.0
Content-type: " . $this->mail_type ."; charset=" . $this->encoding . "
Content-transfer-encoding: 8bit
Date: " . date('r', time()) . "
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: PHP
X-MimeOLE: Produced By phpBB2
" . $this->extra_headers . (($cc != '') ? "Cc: $cc
" : '')  . (($bcc != '') ? "Bcc: $bcc
" : ''); 
圖檔

3.打開 \templates\your_templates\admin\user_email_body.tpl

代碼: 選擇全部

尋找 
<tr> 
<td class="row1" align="right"><b>{L_RECIPIENTS}</b></td> 
<td class="row2" align="left">{S_GROUP_SELECT}</td> 
</tr> 

在上方加入 

<tr> 
<td class="row1" align="right"><b>TYPE</b></td> 
<td class="row2" align="left"> 
<input checked type="radio" value="text/plain" name="mail_type">TEXT  <input type="radio" value="text/html" name="mail_type">HTML</td> 
</tr>


圖檔

完成

寄出的信件通常含有一些訊息,可以到\language\lang_chinese_traditional_taiwan\email\admin_send_email.tpl更改
yuankuei
星球普通子民
星球普通子民
文章: 23
註冊時間: 2003-07-24 04:21
來自: CA 91801
聯繫:

文章 yuankuei »

來來來..把他修改完整一點.. :lol:
直接判斷是 TEXT 還是 HTML,來套用不同的模式檔..

1.打開 admin_mass_email.php,尋找\r
[php]
$emailer->use_template('admin_send_email');
[/php]

取代成
[php]
if ( $mail_type == 'text/html' )
$emailer->use_template('admin_send_email_h');
else
$emailer->use_template('admin_send_email');
[/php]

2.複製下面另存成檔案 admin_send_email_h.tpl,或者更改成你想要的格式
[php]
Charset: big5

這封電子郵件是由"{SITENAME}"管理團隊所寄出.<br />
<br />
假如這封電子郵件的內容令你感到不愉快, 甚至是惡意的攻擊批評, 請利用以下的連結提出申訴:<br />
<br />
<a href="mailto:{BOARD_EMAIL}">{BOARD_EMAIL}</a><br />
<br />
包含這封完整的電子郵件(特別是標題).<br />
<br />
附帶給你的訊息如下:<br />
~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br />
<br />
{MESSAGE}

[/php]

這樣就可以發送兩種不同格式的郵件通知.. :-D
aaron
星球公民
星球公民
文章: 37
註冊時間: 2002-05-29 01:51
聯繫:

文章 aaron »

讚...^^
bubu
星球普通子民
星球普通子民
文章: 1
註冊時間: 2003-09-20 05:43

文章 bubu »

這個mod似乎有漏洞。
會讓「私人訊息」的「Content-type」變成空白。
請問有大大可以協助補強嗎?^_^
appletheme
星球普通子民
星球普通子民
文章: 11
註冊時間: 2004-02-25 00:10

文章 appletheme »

請問要如何將主題回覆通知也改成HTML的格式呢?
minka
星球普通子民
星球普通子民
文章: 18
註冊時間: 2005-01-12 20:00

文章 minka »

appletheme 寫:?
請問如何將HTTP HEADER宣告在PHP語言前?該將HEADER放在哪一個檔案才能讓開啟viewtpic.php前先讀到給定的HEADER
主題已鎖定

回到「外掛問題討論」