Web mail收發信件就如同google的gmail一般,可以透過瀏覽器進行,對於使用上是一種便利的方式,
所以可以選擇裝上openwebmail來提供此功能。
因為此軟體並不包含在Centos內,所以執行以下指令進行安裝:
cd /etc/yum.repos.d
wget -q http://openwebmail.org/openwebmail/download/redhat/rpm/release/openwebmail.repo
yum install openwebmail
執行完以上指令即可安裝好openwebmail。
再來就是設定openwebmail了,首先執行以下指令:
/var/www/cgi-bin/openwebmail/openwebmail-tool.pl --init
在centos 6.5 環境下會出現以下訊息:
Please change '/var/www/cgi-bin/openwebmail/etc/dbm.conf' from
dbm_ext .db
dbmopen_ext .db
dbmopen_haslock no
to
dbm_ext .pag
dbmopen_ext none
dbmopen_haslock no
依照訊息要求內容將dbm.conf檔案內容修改好,存檔後離開。
再次執行以下指令:
/var/www/cgi-bin/openwebmail/openwebmail-tool.pl --init
會出現如下訊息:
creating db /var/www/cgi-bin/openwebmail/etc/maps/b2g ...done.
creating db /var/www/cgi-bin/openwebmail/etc/maps/g2b ...done.
creating db /var/www/cgi-bin/openwebmail/etc/maps/lunar ...done.
Creating UTF-8 locales...
langconv ar_AE.CP1256 -> ar_AE.UTF-8
langconv ar_AE.ISO8859-6 -> ar_AE.UTF-8
langconv bg_BG.CP1251 -> bg_BG.UTF-8
langconv ca_ES.ISO8859-1 -> ca_ES.UTF-8
langconv cs_CZ.ISO8859-2 -> cs_CZ.UTF-8
langconv da_DK.ISO8859-1 -> da_DK.UTF-8
langconv de_DE.ISO8859-1 -> de_DE.UTF-8
langconv el_GR.ISO8859-7 -> el_GR.UTF-8
langconv en_US.ISO8859-1 -> en_US.UTF-8
langconv es_AR.ISO8859-1 -> es_AR.UTF-8
langconv fi_FI.ISO8859-1 -> fi_FI.UTF-8
langconv fr_FR.ISO8859-1 -> fr_FR.UTF-8
langconv he_IL.CP1255 -> he_IL.UTF-8
langconv hr_HR.ISO8859-2 -> hr_HR.UTF-8
langconv hu_HU.ISO8859-2 -> hu_HU.UTF-8
langconv id_ID.ISO8859-1 -> id_ID.UTF-8
langconv it_IT.ISO8859-1 -> it_IT.UTF-8
langconv ko_KR.eucKR -> ko_KR.UTF-8
langconv lt_LT.CP1257 -> lt_LT.UTF-8
langconv nl_NL.ISO8859-1 -> nl_NL.UTF-8
langconv no_NO.ISO8859-1 -> no_NO.UTF-8
langconv pl_PL.ISO8859-2 -> pl_PL.UTF-8
langconv pt_BR.ISO8859-1 -> pt_BR.UTF-8
langconv pt_PT.ISO8859-1 -> pt_PT.UTF-8
langconv ro_RO.ISO8859-2 -> ro_RO.UTF-8
langconv ru_RU.KOI8-R -> ru_RU.UTF-8
langconv sk_SK.ISO8859-2 -> sk_SK.UTF-8
langconv sl_SI.CP1250 -> sl_SI.UTF-8
langconv sr_CS.ISO8859-2 -> sr_CS.UTF-8
langconv sv_SE.ISO8859-1 -> sv_SE.UTF-8
langconv th_TH.TIS-620 -> th_TH.UTF-8
langconv tr_TR.ISO8859-9 -> tr_TR.UTF-8
langconv uk_UA.KOI8-U -> uk_UA.UTF-8
...done.
Welcome to the OpenWebMail!
This program is going to send a short message back to the developer,
so we could have the idea that who is installing and how many sites are
using this software, the content to be sent is:
OS: Linux 2.6.32-358.23.2.el6.x86_64 x86_64
Perl: 5.010001
WebMail: OpenWebMail 2.53 20080123
Send the site report?(Y/n) n
Thank you.
這樣表示已經設定完成了。
不過如果你的centos是最小化安裝,還要補上一個perl-CGI成是才行,否則開啟openwebmail時將會出現internal server error這樣的錯誤訊息,執行以下指令:
yum install perl-CGI
安裝完後重啟httpd,執行:
service httpd restart
即可看到openwebmail的登入畫面。
可是我安裝到這裡之後發現openwebmail可以正確發信但看不到送進來的郵件,我是以gmail帳號進行交叉測試,
經上網查詢以後得到的消息表示,openwebmail並不支援postfix的maildir功能。
早期的mail是將所有信件放在同一個檔案內放在 /var/~mail 這個資料夾內,以使用者名稱為檔案名稱。
這在信件越來越大的時候會造成反應的遲緩,所以在前面章節中是以maildir的方式儲存信件,這個方式會在使用者家目錄下建立一個新目錄存放郵件,
且郵件會以單一封信件為一個檔名進行存取,在效率上會比單一檔案方式來的好。
但openwebmail在2008之後即停止更新維護,所以不支援maildir這個功能。
管理這在這裡有兩種選擇:
1. 放棄maidir,改回傳統方式。
2. 放棄openwebmail改用其他webmail程式。
我選擇方案1是因為上網看了一下方案2的選擇並不是太多太好,所以在小型系統上換回傳統儲存郵件的方式是合理的。
所以需要修改postfix與dovecot的設定檔,修改 /etc/postfix/main.cf,將前面章節加上的這一行註記掉:
#home_mailbox = Mail/
存檔後離開,重新啟動postfix即可生效,執行指令:
service postfix restart
再來修改dovecot設定,編輯 /etc/dovecot/conf.d/10-mail.conf
移除這行註記:
mail_location = mbox:~/mail:INBOX=/var/mail/%u
這是恢復mail的預設路徑,再來註記掉maidir:
#mail_location = maildir:~/Mail
存檔後離開,重新啟動dovecot即可生效,執行指令:
service dovecot restart
以瀏覽器開啟openwebmail的預設路徑 http://ip/webmail 或是 http://domainname/webmail 看到登入畫面並以使用者帳號登入測試,
能正確開啟並收發信件即表示openwebmail安裝完畢。