21.38. Cyrus-IMAP 將 8-bit 文字轉換為 X 的問題

Contributed by 小郭 (jimkou.bbs@bbs.sayya.org)

Last Update: Sat May 17 12:09:58 2003

mail/cyrus-imapd2-2.1.13 架設郵件伺服器,有些信件的主旨全部變成了 XXXXXX ? 這是 RFC 2047 的標準不相容 8Bit 主旨的郵件。 目前能用的辦法是將標題編碼,這是比較標準的做法, 或是修改 source code 兩個檔案 imap/lmtpengine.c 以及 imap/message.c 讓收信的 IMAPD 支援 8Bit 主旨。

--- imap/lmtpengine.c.orig Sat May 17 14:45:39 2003
+++ imap/lmtpengine.c   Sat May 17 14:48:07 2003
@@ -739,6 +739,7 @@
     state s = NAME_START;
     int r = 0;
     int reject8bit = config_getswitch("reject8bit", 0);
+    int ignore8bit = config_getswitch("ignore8bit", 0);
 
     if (namelen == 0) {
    namelen += NAMEINC;
@@ -854,7 +855,7 @@
               form. */
            r = IMAP_MESSAGE_CONTAINS8BIT;
            goto ph_error;
-           } else {
+           } else if (!ignore8bit) {
            /* We have been configured to munge all mail of this
               form. */
            c = 'X';
--- imap/message.c.orig    Fri Apr 18 06:49:49 2003
+++ imap/message.c  Sat May 17 14:46:27 2003
@@ -229,6 +229,7 @@
     int n;
     int sawcr = 0, sawnl;
     int reject8bit = config_getswitch("reject8bit", 0);
+    int ignore8bit = config_getswitch("ignore8bit", 0);
     int inheader = 1, blankline = 1;
 
     while (size) {
@@ -264,7 +265,7 @@
            /* We have been configured to reject all mail of this
               form. */
            if (!r) r = IMAP_MESSAGE_CONTAINS8BIT;
-           } else {
+           } else if (!ignore8bit) {
            /* We have been configured to munge all mail of this
               form. */
            *p = 'X';

最後再編輯 ${PREFIX}/etc/imapd.conf 並增加一行:

ignore8bit = yes

RFC 2047 MIME (Multipurpose Internet Mail Extensions) Part Three: Message Header Extensions for Non-ASCII Text

WWW: http://asg.web.cmu.edu/cyrus/