Categories: Linux筆記

openwebmail收信人過多亂碼問題


openwebmail 2.53收信人如果別名有中文且收件人很多的話信件會變成亂碼
mail原始碼情形大概如下

From: “=?UTF-8?Q?=E5=BC=B5=E5=90=9B=E8=B1…
To: =?UTF-8?Q?=E5=BC=B5=E5=90=9B=E8=B1=AA… ←收件者
Message-Id: <20130206065804.E2FD24E50530@… Date: Wed, 6 Feb 2013 14:58:04 +0800 (CS… Status: RO X-UID: 2785 Content-Length: 2404 =?UTF-8?Q?___=E5=BC=B5=E5=90=9B=E8=B1=AA_… ←收件者 =?UTF-8?Q?___=E5=BC=B5=E5=90=9B=E8=B1=AA_… ←收件者 Subject: test Date: Wed, 6 Feb 2013 14:58:04 +0800 收件者沒有在同一個區塊 目前不知道是一行超過字元限制還是換行字元轉utf8會有問題 修正/var/www/cgi-bin/openwebmail/openwebmail-send.pl 大概在約1880行處 原本CODE if ($to ne ”) { $s = “To: “.ow::mime::encode_mimewords(folding($to), (‘Charset’=>$composecharset)).”n”;
dump_str($s, $smtp, $folderhandle, $do_send, $do_save, $senderr, $saveerr);
$messageheader.=$s;
}

修改成
if ($to ne ”) {
$s = “To: “.folding(ow::mime::encode_mimewords($to,
(‘Charset’=>$composecharset))).”n”;
dump_str($s, $smtp, $folderhandle, $do_send, $do_save, $senderr, $saveerr);
$messageheader.=$s;
}

先把收件者轉成utf-8再folding
打完收工!

yan

Share
Published by
yan
Tags: openwebmail