邮件服务器使用的点点滴滴及问题汇总(2)

七、企业人员太多,邮箱帐号记不住?让全局邮件列表来帮你,在webmail写邮件时不需要记住对方的邮箱帐号,直接选中即可。
实现方法:   #cd $/extmail/tools
#vim   makeglobabook.pl

#!/usr/bin/perl -w
#
# makeglobabook.pl
# make extmail globa book for mysql server. 
# ver 0.2

use strict;
use DBI;
use IO::File;
use lib "../libs";
use Ext;
use POSIX qw(strftime);
use vars qw(@ISA $usercfg $sysconfig);

my $gbook="../globabook.cf";
my $time = strftime ("%Y\-%m\-%d\_%H\:%M\:%S", localtime);
my $app = Ext->new( config => '../webmail.cf' );

system("mv $gbook $gbook.$time") if -f $gbook;

my $dbuser = $Ext::Cfg{SYS_MYSQL_USER};
my $dbpassword = $Ext::Cfg{SYS_MYSQL_PASS};
my $dbname = $Ext::Cfg{SYS_MYSQL_DB};

my $dbh = DBI->connect("dbi:mysql:database=$dbname",$dbuser,$dbpassword)
    or die "Can not connect DB server!\n";

my $query=qq~SELECT `username`,`name` FROM mailbox ~;
my $sth=$dbh->prepare($query);
$sth->execute();

my $fh=IO::File->new(">$gbook");
print $fh "Name,Mail,Company,Phone\n";

while (my @row=$sth->fetchrow_array()){
    print $fh "\"$row[1]\",\"$row[0]\"\n";
}
#chmod 755 makeglobabook.pl
#./makeglobabook.pl 就会更新上一级目录的globabook.cf文件了。可放入crontab中定期执行

八、搭建完以后的性能优化,应对500+用户的环境(extmail论坛牛人发的)
1、修改/usr/lib/courier-imap/etc/pop3d
MAXDAEMONS=512
MAXPERIP=9000

2、修改/etc/authlib/authdaemonrc
daemons=256

3、修改/etc/amavisd.conf
$max_servers = 50;

4、修改/usr/sbin/apachectl
HTTPD='/usr/sbin/httpd.worker'

5、修改/etc/httpd/conf/httpd.conf
<IfModule worker.c>
StartServers         10
MaxClients       1500
ServerLimit         100
MinSpareThreads     25
MaxSpareThreads     75
ThreadsPerChild     25
MaxRequestsPerChild  0
</IfModule>

6、修改/etc/clamd.conf
MaxThreads 50

7、修改/etc/my.cnf
max_connections=2048

8、去除rar打包exe会被ban的问题
编辑/etc/amavisd.conf,把$banned_filename_re = new_RE 这段内容相应的修改下
如果你知道该重启哪些服务,就重启这些服务,不清楚的话重启下系统就好。

9、加强发信人限制策略
编辑/etc/postfix/master.cf,把-o smtpd_client_restrictions=permit_sasl_authenticated,reject这行注释去掉。

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/e18d366014aa6e6f7fb759fd4a82caa6.html