安裝 squirrelmail
cd /home/pkg
tar -xzvf squirrelmail-1.4.4.tar.bz
cd squirrelmail-1.4.4
cd plugins
tar -xzf ../../quota_usage-1.3-1.2.7.tar.gz
cp quota_usage/config.php.sample quota_usage/config.php
cd ../
./configure
# 你将要設定如下選項
#選擇 “2. Server Settings”=>“A. Update IMAP Settings”=>“8. Server software”改成“courier”;回到主菜單,選擇“4.General Options”=>“1. Data Directoryand”改成“/var/www/data/”;再退回主菜單,選擇“8. Plugins”=>添加你希望用到的插件。回到主菜單,選擇“10. Languages”,将“ Default Language”改成“zh_TW”,“Default Charset”改成“utf-8”。儲存退出。
mv data /var/www/
chown -R vpopmail.vchkpw /var/www/data
mv squirrelmail-1.4.4 /var/www/html/squirrelmail
我在這裡遇到幾個問題:進入網頁裡,報錯imap_server,可能是imap沒啟動,把所有關于QMAIL的服務都要啟動,出現/data和apache不能結合,是因為apache沒權限寫入/data目錄
出現402什麼的字眼,可能是selinux把權限限制了,把selinux關了就行了(在/etc/selinux/config,設定為DISABLE就行了),有時輸入使用者名和密碼出現密碼錯誤,可能是沒給vpopmail的權限,如果出現無法存取頁面的錯誤,那麼注意seisson的權限問題
這裡要提一下squirrelmail漢化:
小松鼠郵件系統漢化
小松鼠本身支援很多語言,可下載下傳相應的語言包。可到其首頁去下載下傳
下載下傳漢化包,這裡給出現在的漢化包:
wget [url]http://switch.dl.sourceforge.net/sourceforge/squirrelmail/zh_CN-1.4.4-20050308.tar.gz[/url]
8.3 漢化包安裝
tar zxvf zh_CN-1.4.4-20050308.tar.gz
解壓之後有locale目錄,把locale下的檔案移到squirrelmail目錄下的locale目錄下就行了
支援LDAP:
進入/var/www/html/squirrelmail/config/下(根據自己安裝的目錄所定)
vi config.php
................................................................................................
..........................................................................................................
...........................................................................................................
$theme[48]['NAME'] = 'Classic Blue 2';
$theme[49]['PATH'] = SM_PATH . 'themes/powder_blue.php';
$theme[49]['NAME'] = 'Powder Blue';
$theme[50]['PATH'] = SM_PATH . 'themes/techno_blue.php';
$theme[50]['NAME'] = 'Techno Blue';
$theme[51]['PATH'] = SM_PATH . 'themes/turquoise.php';
$theme[51]['NAME'] = 'Turquoise';
$default_use_._addr_book = false;
$ldap_server[0] = array(
'host' => '192.168.10.220',填上LDAP伺服器的IP
'base' => 'dc=webmail,dc=print68,dc=com',填上LDAP伺服器的域名
'name' => '192.168.10.220',填上LDAP伺服器的名字
'port' => 389,填上LDAP的端口,這是預設的
'charset' => 'utf-8'語言
);
$abook_global_file = '';
$abook_global_file_writeable = false;
$abook_global_file_listing = true;
$abook_file_line_length = 2048;
或者在/var/www/html/squirrelmail下
執行./configure
#選擇 “6. Address Books”=>“1. Change LDAP Servers”=>然後自己按提示選擇
由于LDAP伺服器版本是V3的,但squirrelmail支援的是V2,是以要在/usr/local/openldap/etc/openldap/sladp.conf 裡
# Sample security restrictions
# Require integrity protection (prevent hijacking)
# Require 112-bit (3DES or better) encryption for updates
# Require 63-bit encryption for simple bind
# security ssf=1 update_ssf=112 simple_bind=64
allow bind_v2 在這裡加上這行,讓他支援V2版本
# Sample access control policy:
# Root DSE: allow anyone to read it
# Subschema (sub)entry DSE: allow anyone to read it
# Other DSEs:
# Allow self write access
# Allow authenticated users read access
# Allow anonymous users to authenticate
因為我們把 SquirrelMail 預設編碼設為 Big5 ,但 LDAP 的 LDIF 資訊皆為 UTF-8 編碼格式,前提是系統了裝了PHP-ICONV的包,如果沒裝,系統盤裡有包
是以我們要進/var/www/html/squirrelmail/functions/abook_ldap_server.php 裡
310 // $fullname = $this->charset_decode($row['cn'][0]); //預設值
311 $fullname = iconv("utf-8","big5",$row['cn'][0]); //將 LDAP 查到的 utf-8 中文資訊轉換成 big5 在傳給 SquirrelMail
#vi /usr/local/www/data/squirrelmail/functions/abook_ldap_server.php
264 //$expr = $this->charset_encode($expr); //預設值
265 $expr = iconv("big5","utf-8",$expr); //輸入搜尋條件為 big5 但轉換成 utf-8 在去查 LDAP
使用 IE 登入 SquirrelMail 後收到中文檔名的附件按下 Download 後原來的中文檔名檔案下載後變成亂碼檔名
#vi /usr/local/www/data/squirrelmail/src/download.php
102 $filename = charset_encode($filename,$default_charset,false); //加在這行下面
103 $filename = iconv("big5","utf-8",$filename); //加入此行
讓長的郵件内容自動換行
用SquirrelMail顯示長的郵件内容時有一個缺陷,就是不會自動換行。檢視源檔案後,發現
問題有兩點:一是在顯示郵件内容時使用的是“pre”辨別,二是表格TD都是不定長的。
要讓長的郵件内容能自動換行,需要做如下改動:
1、不再使用“pre”辨別顯示郵件内容:
vi functions/mime.php
-- $body = '<pre>' . implode("\n", $body_ary) . '</pre>';
++ $body = implode("<BR>\n",$body_ary);
2、找到顯示“$messagebody”的TD語句,将TD改成定長:
vi src/read_body.php
老版本:
-- " <TR><TD BGCOLOR=\"$color[4]\" WIDTH=\"100%\">\n"
++ " <TR><TD BGCOLOR=\"$color[4]\" WIDTH=\"580\">\n"
新版本:
-- html_tag( 'td', '<br>'. $messagebody."\n", 'left')
++ html_tag( 'td', '<br>'. $messagebody."\n", 'left','','width=580')
添加change_sqlpass如果提示
Could not find Pear DB library
解決方案如此:Could not find Pear DB library 這個錯誤終于解決了
隻要安裝Pear DB library就行了
root@MyDapper:/usr/local/php/bin# ./pear install DB
downloading DB-1.7.6.tgz ...
Starting to download DB-1.7.6.tgz (124,807 bytes)
............................done: 124,807 bytes
install ok: channel://pear.php.net/DB-1.7.6
root@MyDapper:/usr/local/php/bin# ./pear list
Installed packages, channel pear.php.net:
=========================================
Package Version State
Archive_Tar 1.3.1 stable
Console_Getopt 1.2 stable
DB 1.7.6 stable
MDB2 2.3.0 stable
PEAR 1.4.11 stable
XML_RPC 1.5.1 stable
我配change_sqlpass沒成功啊!!!有哪位配成功了share下