二、修改配置文件
#vim /etc/postfix/main.cf
其中mydestination那行,原文件有仅需要添加#符号即可
余下所有行需要手动添加至文件末尾
#mydestination = $mydomain, $myhostname
virtual_mailbox_base = /mailbox
virtual_alias_maps = mysql:/etc/postfix/mysql_virtual_alias_maps.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql_virtual_mailbox_maps.cf
virtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_domains_maps.cf
virtual_uid_maps = static:1000
virtual_gid_maps = static:1000
复制数据库文件:
#cp mysql_virtual_* /etc/postfix/
安装courier,该软件可以验证数据库中的用户与密码
#cd /media/20<tab>
#tar -xjf courier<tab> -C /usr/src
#cd /usr/src/courier<tab>
#./configure --prefix=/usr/local/courier-authlib --without-stdheaderdir --with
-authmysql --with-RedHat --with-mysql-libs=/usr/local/mysql/lib/mysql/ --with-
mysql-includes=/usr/local/mysql/include/mysql/
#make && make install
#make install-configure
#vim /etc/ld.so.conf
在该文件末尾添加一行
/usr/local/courier-authlib/lib/courier-authlib
保存退出后,执行命令ldconfig
修改第一个配置文件:
#vim /usr/local/courier-authlib/etc/authlib/authdaemonrc
27行改为:authmodulelist="authmysql"
34行改为:authmodulelistorig="authmysql"
修改一下权限:
#chmod -R 755 /usr/local/courier-authlib/var/spool/authdaemon/
修改第二个配置文件:
#vim /usr/local/courier-authlib/etc/authlib/authmysqlrc
备注:参数分别位于,26,27,28,49,68,83,92,113,119,128,133,139,150行。
MYSQL_SERVER localhost
MYSQL_USERNAME extmail
MYSQL_PASSWORD extmail
MYSQL_SOCKET /tmp/mysql.sock
MYSQL_DATABASE extmail
MYSQL_USER_TABLE mailbox
MYSQL_CRYPT_PWFIELD password
MYSQL_UID_FIELD uidnumber
MYSQL_GID_FIELD gidnumber
MYSQL_LOGIN_FIELD username
MYSQL_HOME_FIELD concat('/mailbox/',homedir)
MYSQL_NAME_FIELD name
MYSQL_MAILDIR_FIELD concat('/mailbox/',maildir)
拷贝启动脚本:
#cp /usr/src/courier<tab>/courier-authlib.sysvinit /etc/init.d/courier-authlib
#chmod 755 /etc/init.d/courier-authlib
#service courier-authlib start
#cp /usr/lib/sasl2/Sendmail.conf /usr/lib/sasl2/smtpd.conf
#vim /usr/lib/sasl2/smtpd.conf
pwcheck_method:authdaemond
authdaemond_path: /usr/local/courier-authlib/var/spool/authdaemon/socket
配置Dovecot,使之支持收取数据库邮件,注意内容原文件有,仅需去#符号即可,行号大约为:208,790,899,962行左右。
#vim /etc/dovecot-mysql.conf (该文件默认不存在,需要手动创建)内容如下:
driver = mysql
connect = host=localhost dbname=extmail user=extmail password=extmail
default_pass_scheme = CRYPT
password_query = SELECT username AS user,password AS password FROM mailbox
WHERE username = '%u'
user_query = SELECT maildir, uidnumber AS uid, gidnumber AS gid FROM mailbox
WHERE username = '%u'
创建目录,并修改其权限
#mkdir -p /mailbox/extmail.org/postmaster/Maildir/
#chown -R postfix:postfix /mailbox
最后,部署Extmail邮件系统(支持使用浏览器收发邮件)
#cd /media/20<tab>
#tar -xzf Unix-Sys<tab> -C /usr/src
#tar -xzf DBI<tab> -C /usr/src
#tar -xzf DBD<tab> -C /usr/src
#tar -xzf extmail<tab> -C /usr/src
#PATH=$PATH:/usr/local/mysql/bin/
#cd /usr/src/Unix<tab>
#perl Makefile.PL
#make && make install
#cd /usr/src/DBI<tab>
#perl Makefile.PL
#make && make install
#cd /usr/src/DBD<tab>
#perl Makefile.PL
#make && make install
#mv /usr/src/extmail<tab> /usr/local/apache2/htdocs/extmail将网站拷贝到apache目录下发布网站。