您的位置:首页 > 产品设计 > UI/UE

squirrelmail+openldap安装备忘录

2007-05-18 10:11 405 查看
  安装  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

    cd ../

    mv squirrelmail-1.4.4 /var/www/html/squirrelmail

我在这里遇到几个问题:进入网页里,报错imap_server,可能是imap没启动,把所有关于QMAIL的服务都要启动,出现/data和apache不能结合,是因为apache没权限写入/data目录
 出现402什么的字眼,可能是selinux把权限限制了,把selinux关了就行了(在/etc/selinux/config,设置为DISABLE就行了)
   
      这里要提一下squirrelmail汉化:
    小松鼠邮件系统汉化
小松鼠本身支持很多语言,可下载相应的语言包。可到其主页去下载

下载汉化包,这里给出现在的汉化包:
wget  http://switch.dl.sourceforge.net/sourceforge/squirrelmail/zh_CN-1.4.4-20050308.tar.gz 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_javascript_addr_book = false;
$ldap_server[0] = array(
    'host' => '192.168.10.220',填上LD
4000
AP服务器的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')

  
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息