分享

Windows下配置HMailServer+Squirrelmail(飞城原创)

 peijs5201314 2014-01-06

Windows下配置HMailServer+Squirrelmail(飞城原创)

分类:学习啊工作 | 标签: Hmailserver 
2012-10-23 19:51阅读(240)评论(0)

Windows下配置HMailServer+Squirrelmail(飞城原创)

飞城, beijingflycity@qq.com

     2012.10.22

     

    HMailServer是一个运行于Windows系统的,基于GPL授权的,免费的,开源的邮件系统,支持SMTP,POP3,IMAP,并且提供了一个开放的COM接口,可供和其它的应用程序结合使用,或是二次开发。 它具有防病毒,防垃圾,多域名,别名,备份域等众多功能。邮件数据存放在数据库服务器中,可使用你MySQL,MS SQL及其它你选择的数据库服务器。

1.download hMailServer, a free e-mail server for Microsoft Windows
  http://www./ 
  2012.10.21: hMailServer 5.3.3 - Build 1879 (build on 2010-06-07)

2.Install hMailServer:
  运行hMailServer-5.3.3-B1879.exe,开始安装.
  安装过程中,默认为使用microsoft sqlserver compact,也可以选择使用外部的mysql等.
  安装过程中,需要设置管理员密码。

3.汉化
  将chinese.ini拷贝到hMailServer安装目录中的languages目录中
  修改hMailServer安装目录中的Bin目录中hMailServer文件如下:
  [GUILanguages]
  ValidLanguages=chinese,english,swedish
  进入windows服务,重起hMailServer。
  运行bin目录中的hMailAdmin.exe,可以选择中文了。

4.添加服务器管理员
  创建一个域,添加用户时,选择管理角色为 服务器。如localhost.com域下的c用户。
 
5.web管理页面配置
  假设apache和php都已经配置好
  将hMailServer安装目录中的PHPWebAdmin目录在Apache配置文件httpd.conf中,配置虚拟目录
  修改PHPWebAdmin目录中的config-dist.php为config.php,修改其中的配置参数:
  如:
  $hmail_config['rooturl'] = "http://localhost:8088/h/PHPWebAdmin/index.php";
  $hmail_config['defaultlanguage']= "chinese";
  浏览器访问管理页面,用户名可以使用先前创建的c@localhost.com.
  登陆后,管理页面功能同hMailAdmin.exe管理界面。 
  
6. web邮件客户端(Squirrelmail)配置
  下载Squirrelmail:http:///
  当前最新版本:squirrelmail-webmail-1.4.22.zip
  解压缩squirrelmail-1.4.11.zip 到 c:\web-app\SquirrelMail 文件夹,该文件夹将作为Apache Http Server 的虚拟目录使用。

 

7。下载 ActivePerl-5.8.8.822-MSWin32-x86-280952.msi 地址:http://www./ActivePerl/
  安装ActivePerl
  ActivePerl是Windows 环境下的 perl 语言源代码的解释器。支持 Microsoft IIS。包括有 Perl for Win32、Perl for ISAPI、PerlScript、PerlPackageManager 四套程序。安装后就可以直接运行.pl文件。

 

8。配置Squirrelmail:
   运行c:\web-app\SquirrelMail\config\config.pl 根据提示进行初始化设置。 将Default_charset设置为 "UTF-8" 将Domain设置为 "dev.com" Windows 2003 可以将Send And SMTP设置为SMTP这样就可以直接使用2003的SMTP服务来发送邮件,就无需安装SendMail组件了。
   修改 c:\web-app\SquirrelMail\config\config.php
$data_dir = 'c:\web-app\SequirreMail\data
$attachment_dir = 'c:\web-app\SequirreMail\attach

在Apache的Httpd.conf增加以下配置:
Alias /mail "C:/web-app/SquirrelMail"
<directory "C:/web-app/SquirrelMail">
Options Indexes
Order allow,deny
Allow from all
</directory>


9. 汉化Squirrelmail。

   还是从Squirrelmail.org网站上下载中文包,解压缩到相应的目录下。

   修改config.php:

$squirrelmail_default_language = 'zh_CN';
$default_charset       = 'UTF-8';
$domain                 = 'localhost.com';
$imapServerAddress      = 'localhost.com';
$smtpServerAddress      = 'localhost.com';

 

10.对它的Drafts、Sent、Trash三个邮箱名的汉化

下载的中文包汉化后,它的Drafts、Sent、Trash三个邮箱名还是英文的,如下修改进行汉化:

左边的邮箱目录在left_main.php中,打开它,增加一个function

// --Add by Anjo, 2006.9.3
function rename_subbox($mailboxstr, $oldname, $newname) {
    $len0=strlen($mailboxstr);
    $len1=strlen($oldname);
    if (strpos($mailboxstr, $oldname, $len0-$len1)==$len0-$len1) {
        return substr($mailboxstr, 0, $len0-$len1).$newname;
    }
    else
        return $mailboxstr;
}
// --end of Anjo's function

然后找到这一段

    if ($special_color) {
        $line .= "<font color=/"$color[11]/">";
    }
    if ( $mailbox == 'INBOX' ) {
        $line .= _("INBOX");
    } else {
        $line .= str_replace(array(' ','<','>'),array(' ','<','>'),$mailbox);
    }

在它后面加上:

    //-- By Anjo, for translate "Drafts", "Sent" and "Trush"
    $line = rename_subbox($line, "Drafts", "草稿箱");
    $line = rename_subbox($line, "Sent",   "发件箱");
    $line = rename_subbox($line, "Trash",  "回收站");

一切搞定。

 

11.监控邮件设置

   公司localhost.com的老板希望每个员工xxxx@localhost.com发出去的邮件也自动偷偷发到老板的邮箱(boss@localhost.com)中,hmailserver配置起来非常简单。

   直接设置一个全局的rule:

    criteria: use and
     from contains localhost.com

     recipient list not contains boss@localhost.com ,这条不写boss每次收5条相同的邮件。 

   Actions:

     Forward email to boss@localhost.com
 

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多