顯示頁面舊版反向連結Fold/unfold all回到頁頂 本頁是唯讀的,您可以看到原始碼,但不能更動它。您如果覺得它不應被鎖上,請詢問管理員。 ====== 將 Mail Server - IMAP 建立的中文目錄編碼轉回作法 ====== 透過 [[https://imapsync.lamiral.info/|imapsync]] 移轉 Mail Server 過程, 發現一些使用中文所建立的目錄無法成功移轉, 又不好比對出是那些目錄, 所以找了一下可以如何將編碼轉回的方式. * 在 imapsync 執行後的 LOG_imapsync 目錄內看到記錄檔最後有出現 Err Exp.<file> : : Homepage: http://imapsync.lamiral.info/ ++++ Listing 2 errors encountered during the sync ( avoid this listing with --noerrorsdump ). Err 1/2: Could not create folder [from ABC/&ZbBbomI2--DATA/INDIA/JonathanTest.] from [from ABC/&ZbBbomI2--DATA/INDIA/JonathanTest.]: 38252 NO [CANNOT] Character not allowed in mailbox name: '.' (0.001 + 0.000 secs). Err 2/2: Could not create folder [from ABC/&ZbBbomI2--DATA/Vietnam/TrysoftTest] from [from ABC/&ZbBbomI2--DATA/Vietnam/TrysoftTest]: 38949 NO [CANNOT] Character not allowed in mailbox name: '.' (0.001 + 0.000 secs). Exiting with return value 111 Log file is LOG_imapsync/2018_08_26_16_21_49_try.txt ( to change it, use --logfile filepath ; or use --nolog to turn off logging ) </file> * 出現了兩個目錄異常 - [from ABC/&ZbBbomI2--DATA/INDIA/JonathanTest.] - [from ABC/&ZbBbomI2--DATA/Vietnam/TrysoftTest] ===== CentOS 6 安裝 perl Unicode::IMAPUtf7 套件 ===== * <code sh> yum install https://www.rpmfind.net/linux/dag/redhat/el6/en/x86_64/dag/RPMS/perl-Unicode-IMAPUtf7-2.00-1.el6.rf.noarch.rpm </code> ===== 簡單寫個轉碼 perl 程式 ===== * <code perl test.pl> #!/usr/bin/perl use Unicode::IMAPUtf7; my $IMAPUtf7 = Unicode::IMAPUtf7->new(); $encode = '[from ABC/&ZbBbomI2--DATA/INDIA/JonathanTest.] [from ABC/&ZbBbomI2--DATA/Vietnam/TrysoftTest]'; $decode = $IMAPUtf7->decode($encode); print("[$decode]\n"); </code><cli> root@ct-centos6 ~]# perl test.pl [[from ABC/新客戶-DATA/INDIA/JonathanTest.] [from ABC/新客戶-DATA/Vietnam/TrysoftTest]] [root@ct-centos6 ~]# </cli> ===== 參考網址 ===== * http://tyruan.blogspot.com/2013/11/outlook-imap.html * https://www.rpmfind.net/linux/rpm2html/search.php?query=perl(Unicode%3A%3AIMAPUtf7) <WRAP center round tip 60%> 如果對 perl 語法想快速了解, 可以參考以下網址 ((來自 Marc Wilson @PCWDLD.com 2021/09/07 的建議)) * https://www.pcwdld.com/perl-cheat-sheet </WRAP> {{tag>mail imapsync}} tech/mail_imap_encode.txt 上一次變更: 2021/09/07 01:04由 jonathan