http://phpbb-tw.net/phpbb/viewtopic.php?p=231944
以下內容皆是神川小羽所發
下載: http://pbtw.net/phpBB2/dload.php?action=file&file_id=95
整理了幾次,大致上是這樣了,不過使用者必須知道這並不是郵件問題解決的唯一方式,不論是用UTF-8送或BIG5發送都是可行的,使用者就自己衡量看看是用UTF-8還是要改成強制BIG5發送嚕,而當然強制轉換為BIG5也不見的是最好的方式。
代碼: 選擇全部
##############################################################
## 名稱: 郵件強制大五碼發送
## 作者: 神川小羽 <http>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>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
" : '');
#
#---- [ 取代 ] ---------------------------
#
代碼:
//------------ 郵件修正2 開始 ----------------
/** 修改 charset
$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>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>new_email_encode . "
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
" : '');
//------------ 郵件修正2 結束 ----------------
#
#---- [ 找到 ] ---------------------------
#
代碼:
// Send message ... removed $this->encode() from subject for time being
if ( $this->use_smtp )
{
if ( !defined('SMTP_INCLUDED') )
{
include($phpbb_root_path . 'includes/smtp.' . $phpEx);
}
#
#---- [ 之後加入 ] ---------------------------
#
代碼:
//------------ 郵件修正3 開始 ----------------
$this->subject = '=?'.$this->new_email_encode.'?B?' . base64_encode(mb_convert_encoding($this->subject, $this->new_email_encode, $lang['ENCODING'])).'?=';
$this->msg = mb_convert_encoding($this->msg, $this->new_email_encode, $lang['ENCODING']);
$this->extra_headers = mb_convert_encoding($this->extra_headers, $this->new_email_encode, $lang['ENCODING']);
//------------ 郵件修正3 結束 ----------------
#
#---- [ 找到 ] ---------------------------
#
代碼:
else
{
$empty_to_header = ($to == '') ? TRUE : FALSE;
$to = ($to == '') ? (($board_config['sendmail_fix']) ? ' ' : 'Undisclosed-recipients:;') : $to;
#
#---- [ 之後加入 ] ---------------------------
#
代碼:
//------------ 郵件修正4 開始 ----------------
$this->subject = '=?'.$this->new_email_encode.'?B?' . base64_encode(mb_convert_encoding($this->subject, $this->new_email_encode, $lang['ENCODING'])).'?=';
$this->msg = mb_convert_encoding($this->msg, $this->new_email_encode, $lang['ENCODING']);
$this->extra_headers = mb_convert_encoding($this->extra_headers, $this->new_email_encode, $lang['ENCODING']);
//------------ 郵件修正4 結束 ----------------
#
#---- [ 找到 ] ---------------------------
#
代碼:
function attachFile($filename, $mimetype = "application/octet-stream", $szFromAddress, $szFilenameToDisplay)
{
global $lang;
#
#---- [ 之後加入 ] ---------------------------
#
代碼:
//------------ 郵件修正5 開始 ----------------
$lang['ENCODING'] = $this->new_email_encode;
//------------ 郵件修正5 結束 ----------------
#
#---- [ 完成/存檔/上傳檔案 ] ---------------------------
#
#結束