分类: LINUX
2007-06-02 13:00:22
五、服务qmail脚本编写及启动
A. 创建rc、smtp、pop3启动脚本
#cp /var/qmail/boot/home /var/qmail/rc
#vi /var/qmai/rc
#!/bin/sh
exec env - PATH="/var/qmail/bin:$PATH"
qmail-start ./Mailbox splogger qmail &
#vi /var/qmail/smtp
#!/bin/sh
QMAILDUID=qmaild
NOFILESGID=nofiles
/usr/local/bin/tcpserver -H -R -l 0 -t 1 -v -p -x /var/vpopmail/etc/tcp.smtp.cdb -u $QMAILDUID -g $NOFILESGID 0 smtp /var/qmail/bin/qmail-smtpd hostname /var/vpopmail/bin/vchkpw /bin/true /bin/cmd5checkpw /bin/true 2>&1 | /var/qmail/bin/splogger smtpd 3 &
#vi /var/qmail/pop3
#!/bin/sh
/usr/local/bin/tcpserver -H -R 0 pop3 /var/qmail/bin/qmail-popup hostname /var/vpopmail/bin/vchkpw /var/qmail/bin/qmail-pop3d Maildir &
#chmod 755 /var/qmail/rc
#chmod 755 /var/qmail/smtp
#chmod 755 /var/qmail/pop3
B. 创建SystemV管理脚本
#vi /etc/init.d/qmaild [内容见附文末]
#chmod 755 qmaild
#chkconfig --add qmaild
#chkconfig --level 345 qmaild on
六、启动qmail并使用MUA软件进行收发信测试,如果正常再安装qmailadmin和igenus
1. Qmail 配置管理
#service qmaild start
#cd /var/qmail/control
#echo mail.example.org > me //定义邮件服务器本机主机名
#echo -e “mail.example.org\nexample.org\nexample.com\n192.168.2.0\n" > rcpthosts //定义允许转发的收件人邮件域,最多不超过50行,若缺少该文件表示Open relay。若要添加更多行可以使用morercpthosts文件
#echo badboy@bad.domain > badmailfrom //拒绝的邮件地址
#echo postmaster > bouncefrom //定义投递错误反馈邮件时的发送者
#echo 3600 > queuelifetime //指定一个邮件在队列中的最大存活时间
#echo 60 > concurrencylocal //允许并发投递本地邮件个数
#echo 60 > concurrencyremote //允许并发投递远程邮件个数
#echo example.org > defaultdomain
#echo 10485760 > databytes //允许投递的最大邮件大小
#echo recycled.com > doublebouncehost //定义双重退信时改寄目标主机名
#echo recycled > doublebouceto //定义双重退信时改寄目标用户名
#echo -e "example.com:example.com\nexample.org:example.org" >> virtualdomains //定义邮件服务器增加的虚拟域
#echo 60 > timeoutconnect //定义连接到远端smtp服务器时的连接超时
#echo 180 > timeoutremote //定义接受远端smtp服务器连接的响应等待超时
#vi smtproutes //定义qmail系统静态smtp路由表
target.com:realtarget.com
target.com:
target.com:realserver.com:2525
#发送目标域名:转发到实际目标域名:[目标server端口号]
#echo "Welcome to Qmail Server." > smtpgreeting //定义smtp服务器欢迎信息
2. 邮件大小及附件大小控制
#vi /etc/php.ini
register_globals = on
max_execution_time = 60
post_max_size =
upload_max_filesize =
memory_limit =
session.auto_start = 1
#vi /etc/httpd/conf.d/php.conf
SetOutputFilter PHP
SetInputFilter PHP
LimitRequestBody 10485760
#servcie httpd restart
七、安装qmailadmin管理插件
#tar zxvf qmailadmin-
#cd qmailadmin-
#./configure --enable-qmaildir=/var/qmail --enable-ezmlmdir --enable-autoresponder-path --enable-cgibindir=/opt/httpd/cgi-bin
#make && make install-strip
访问: 即可进行管理
2. 修改数据库连接设置
#vi /var/www/html/igenus/config/config_inc.php
$CFG_BASEPATH = "/var/www/html/igenus";
$CFG_MYSQL_HOST = 'localhost';
$CFG_MYSQL_USER = 'vpopmail';
$CFG_MYSQL_PASS = '654321';
$CFG_MYSQL_DB = 'vpopmail';
$CFG_TEMP = $CFG_BASEPATH."/temp";
3. 修改vpopmail数据库
#mysql -u root -p
mysql>use vpopmail;
mysql>alter table vpopmail drop primary key;
mysql>alter table vpopmail add column pw_id int(5) NOT NULL primary key auto_increment;
…… [参考/var/www/html/igenus/docs/iGENUS.sql文件建立其它相关数据库:address、admin、card、logs、messages、personal、scheduler、stow] ……
4. 访问 进行登录、收发信测试
#####################################
############### 附录 ################
#####################################
/etc/init.d/qmaild脚本内容
#####################################
#! /bin/sh
# chkconfig: 2345 90 90
# description: qmaild (include smtp and pop3) auto start/stop scripts.
. /etc/rc.d/init.d/functions
case "$1" in
start)
echo -n "start qmail:"
/var/qmail/rc &
echo "."
echo -n "start smtp service:"
/var/qmail/smtp
echo "."
echo -n "start pop3 service:"
/var/qmail/pop3
echo "."