RoundCube Webmail

以往使用 Webmail 的最佳首選,就是以 Openwebmail 莫屬了,但是因為種種原因,小弟在一篇 Blog 文章中提過,所以在最近一次的公司 Webmail 更新中,決定使用以 IMAP 為主的 Webmail 系統。

使用以 IMAP Client 為主的 Webmail 最少有以下好處:

  1. 只要是支援 IMAP 的 Mail Client (Webmail、Outlook 之類的郵件程式),就可以保持信件處理進度一致。
  2. Mail 是存放在 Server 上的,所以 User 不用擔心電腦重新安裝後會發生舊信件不見的問題。

以上是採用 IMAP Client 為的主要原因。

然而以 IMAP Client 為基準的 Webmail 系統很多,為什麼使用 RoundCube,是因為它的介面太華麗啦!所以就用它囉,我們使用者最主要的需求只有收發信而已,其它太花俏的功能反而不需要。

在這裡先來看一張 RoundCube 的畫面:

接著,RoundCube 需要的執行環境如下:

  • MySQL 5
  • PHP 5 (包含 imap,mysql 等模組)
  • Apache

因為 CoundCube 是 IMAP Client 的套件,所以不需要與 SMTP 郵件系統安裝在一起,只要 mail 郵件伺服器支援 SMTP 協定即可。如此即可減少 mail 郵件伺服器的負擔。

廣 告

編譯 PHP

若是您的環境已經完全符合需求,那麼就可以跳過此一章節。

PHP 編譯注意事項:

PHP 安裝編譯時,需注意使用下列項目:

0001
 
 
root # ./configure --with-apxs2=/usr/local/httpd/bin/apxs --enable-magic-quotes --enable-libgcc --enable-ftp --enable-mbstring=all --with-mysql=/usr/local/mysql --enable-sockets
 --with-gnu-ld --with-gd --enable-ftp --with-zlib --disable-debug --with-iconv --with-zlib --enable-sockets --with-ttf --with-jpeg-dir=/usr/lib --with-freetype-dir=/usr/lib --wi
th-imap --with-kerberos --with-imap-ssl --with-mcrypt --enable-mbregex --with-mime-magic --with-gettext

以上粗體字是在編譯 PHP 時需要特別注意的,若您在安裝系統時和我一樣都是從最基楚的套件安裝,那麼您可能還需要額外安裝下列 RPM 套件:

0001
root # yum install libjpeg-devel libpng-devel freetype-devel libc-client-devel libmcrypt-devel -y

安裝完成後,請使用 phpinfo(); 來查看是否已支援 IMAP 與 MySQL 項目,畫面如下:

您的版本可能與上面的不同,但是這並沒有關係,只要符合最低標準即可。

安裝設定 RoundCube Webmail

RoundCube Webmail 可到 專案的下載頁 取得,本文編輯時最新的版本為 0.2-beta 版本。

下載 RoundCube 並安裝

0001
0002
0003
0004
root # cd /usr/local/httpd/htdocs
root # wget http://nchc.dl.sourceforge.net/sourceforge/roundcubemail/roundcubemail-0.2-beta2.tar.gz
root # tar -zxvf roundcubemail-0.2-beta2.tar.gz
root # mv roundcubemail-0.2-beta2 rdmail

匯入資料庫:

建立使用者並設定權限:

0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
root # /usr/local/mysql/bin/mysql -u root -p -h localhost
Enter password:
Welcome to the MySQL monitor.  Commands end with ; or g.
Your MySQL connection id is 253
Server version: 5.1.30-log Source distribution

Type 'help;' or 'h' for help. Type 'c' to clear the buffer.

mysql>create database rdmail;
mysql>GRANT ALL PRIVILEGES ON rdmail.* TO rdmail@localhost IDENTIFIED BY 'your-password';

匯入 RoundCube 資料庫:

0001
0002
root # cd /usr/local/httpd/htdocs/rdmail/SQL
root # /usr/local/mysql/bin/mysql -u rdmail -p -h localhost rdmail < mysql5.initial.sql

匯完資料庫後,開啟您的 Web Browser,輸入網址後開始設定,本文以 192.168.5.101 作為 webmail 的主機。

http://192.168.5.101/rdmail/installer/

接下來的畫面就照著指示走就好了!

在設定主機項目時,請注意以下項目:

  • IMAP Server 指的是要設定為有 IMAP 服務的主機 (一般與 mail 郵件伺服器為同一主機)。
  • SMTP 指的是您的發信主機 (一般與 mail 郵件伺服器為同一主機)。
  • 資料庫使用者帳號、密碼與資料庫名稱為先前所設定的。

輸入完成後,會輸出兩個 php 程式碼,請把這些程式碼複製起來,並且儲存到 /usr/local/httpd/htdocs/rdmail/config/main.inc.php 與 /usr/local/httpd/htdocs/rdmail/configdb.inc.php。

當您複製好整個 php 檔後,就可以開始使用這個 Webmail 服務了,但是還是建議您編輯 main.inc.php 檔案,修改裡面的參數讓使用者起更加方便:

0001
0002
$rcmail_config['auto_create_user'] = true;
$rcmail_config['create_default_folders'] = TRUE;

設定完成後,請開啟 Web Browser,並且開始使用!

12/27/2008

首頁