本篇主要說明EML格式信件檔案,如何匯入、建立成郵件庫:

重要:以下所有指令,均需使用webmail權限執行!!



一、將EML信件檔案利用WINSCP免費程式複製到MB console底層。

注意:請留意使用webmail權限登入WINSCP(不要用root登入WINSCP)將信件複製過去,建議可建立一資料夾,路徑,將檔案放至於此:


/webmail/mbase/var/mbblddb/addqhdr_source



另外底層操作,新建立兩個資料夾:目的端與異常

$mkdir -p /webmail/mbase/var/mbblddb/addqhdr_trash
$mkdir -p /webmail/mbase/var/mbblddb/addqhdr_des



二、將EML信件加入必要之資訊:


工具使用方式:

$ /webmail/mbase/tool/addqhdr.pl
"usage: /webmail/mbase/tool/addqhdr.pl source_directory destination_directory trash_directory [-r]
           [-r] traverse source_derectory recursively


Ex:

/webmail/mbase/tool/addqhdr.pl /webmail/mbase/var/mbblddb/addqhdr_source /webmail/mbase/var/mbblddb/addqhdr_des /webmai/mbase/var/mbblddb/addqhdr_trash


程式跑完後,理論上所有信件會放置於:

/webmail/mbase/var/mbblddb/addqhdr_des


有問題的信件,無法加資訊的信件放置於

/webmai/mbase/var/mbblddb/addqhdr_trash


來源資料夾會清空:

/webmail/mbase/var/mbblddb/addqhdr_source 



三、將信件製作成郵件庫:


工具使用方式:

$ /webmail/mbase/tool/mbblddb
Usage: /webmail/mbase/tool/mbblddb {-d db_dir|-p db_path} -s spool_dir -b tuple_dir -l locale -w working_dir -f feature -t timeout -r child_num -c -u -m -x
feature: "encrypt"
note   : 1. spool_dir and working_dir must be located in same disk partition.
         2. please specify all dir as absolute path.
            because of chdir to /webmail/mbase/bin is necessary while building database.
         3. working_dir should be different from db_dir or db_path.
         4. if -l is not set, will use zh.TW.Big5 as default.
         5. if -p is set, will append mail to db_path.
         6. if -c is set, add traffic data.
         7. if -u is set, will NOT compress mail when finalizing.
         8. if -m is set, will retry to get mail content only when timeout for converting all entity.
         9. -x is for internal use by mbreblddb, skips backup of .rec when -p is set.


建立兩個新資料夾:

$ mkdir -p /webmail/mbase/var/mbblddb/db
$ mkdir -p /webmail/mbase/var/mbblddb/work


Ex:

$ /webmail/mbase/tool/mbblddb -d /webmail/mbase/var/mbblddb/db/ -s /webmail/mbase/var/mbblddb/addqhdr_des -l zh_TW.Big5 -w /webmail/mbase/var/mbblddb/work/ -t 600 -m


-d:郵件庫完成後存放路徑

-s:eml檔案存放位置

-w:工具暫存路徑/異常資料夾(最後結束)

-l:語系(用zh_TW.Big5即可)

-t:轉換timeout時間

-m:當某一信件附件過大,造成timeout,可能會被放置異常資料夾,該參數可retry一次,並只轉換信件內容,不轉附件內容。(強烈建議使用)


因重建過程花費時間久,200GB信件約花5~6小時(仍須依據系統效能),建議背景執行:


$ /webmail/mbase/tool/mbblddb -d /webmail/mbase/var/mbblddb/db/ -s /webmail/mbase/var/mbblddb/addqhdr_des -l zh_TW.Big5 -w /webmail/mbase/var/mbblddb/work/ -t 600 -m &


重建過程會產生記錄檔:


$ tail /webmail/mbase/var/log/mbblddb.log
[2017/10/12 11:50:27][MS=501208][PID=9747] info: main - Putter #22 stopped.
[2017/10/12 11:50:27][MS=501217][PID=9778] info: put - Stopped for receiving command (0x0).
[2017/10/12 11:50:27][MS=501222][PID=9768] info: put - Stopped for receiving command (0x0).
[2017/10/12 11:50:27][MS=501326][PID=9747] info: main - Putter #7 stopped.
[2017/10/12 11:50:27][MS=501341][PID=9747] info: main - Putter #24 stopped.
[2017/10/12 11:50:27][MS=501395][PID=9747] info: main - Putter #14 stopped.
[2017/10/12 11:50:28][MS=500084][PID=9755] warn: conv - No kid data of '/webmail/mbase/tmp/0001.59DEE683.79FEF.9755/kid'.
[2017/10/12 11:50:28][MS=509332][PID=9755] info: put - Stopped for receiving command (0x0).
[2017/10/12 11:50:28][MS=509504][PID=9747] info: main - Putter #1 stopped.
[2017/10/12 11:50:38][MS=578667][PID=9747] info: main - DB '20171012115027' finalized.



四、完成的郵件庫:


$ ll /webmail/mbase/var/mbblddb/db/
總計 8
drwxr-x--- 12 webmail webmail 4096 2017-10-12 11:50 20171012115027


這些信件如果是alex 201701~201702時間範圍信件,修改郵件庫資料夾名稱、並改放置於歸檔列表或離線列表:


搬移至歸檔列表2017年資料夾:

$ cd /webmail/mbase/var/mbblddb/db/
$ mv -v 20171012115027 /webmail/mbase/depot/in/2017/20170101~20170228.alex
‘20171012115027’ -> ‘/webmail/mbase/depot/in/2017/20170101~20170228.alex’


搬移至離線列表某一掛載資料夾:

$ cd /webmail/mbase/var/mbblddb/db/
$ mv -v 20171012115027 /webmail/mbase/depot/ex/test/20170101~20170228.alex
‘20171012115027’ -> ‘/webmail/mbase/depot/ex/test/20170101~20170228.alex’


注意:名稱的命名,勿與系統取名方式(YYYYMMDD~YYYYMMDD)重疊,以免到目的端時,將原本郵件庫蓋過。


五、掛載並提供查詢: