1.安装
在编译maildrop前需要将courier-authlib 的头文件及库文件链接至/usr目录,在编译的时候会到/usr目录下找相关的文件:
# ln  -sv /usr/local/courier-authlib/bin/courierauthconfig  /usr/bin
# ln  -sv /usr/local/courier-authlib/include/*  /usr/include
创建vmail用户
useradd -u 1000 vmail
# tar xf maildrop-2.7.1.tar.bz2
# cd  maildrop-2.7.1
# ./configure  --enable-sendmail=/usr/sbin/sendmail  --enable-trusted-users='root vmail' --enable-syslog=1 --enable-maildrop-uid=1000 --enable-maildrop-gid=1000 && make && make install
# maildrop -v
maildrop 2.7.1 Copyright 1998-2005 Double Precision, Inc.
GDBM/DB extensions enabled.
Courier Authentication Library extension enabled. #有这句话证明安装成功
Maildir quota extension are now always enabled.
This program is distributed under the terms of the GNU General Public
License. See COPYING for additional information.
2.更改配置文件
# vi /etc/postfix/master.cf
maildrop  unix  -       n       n       -       -       pipe
  flags=DRhu user=vmail argv=/usr/local/bin/maildrop -d ${recipient}
注解:maildrop前面不要有空格,下面一行前面要两个空格。
# vi /etc/postfix/main.cf
virtual_uid_maps = static:1000
virtual_gid_maps = static:1000
virtual_transport = maildrop
maildrop_destination_recipient_limit = 1
# vi /etc/authmysqlrc
MYSQL_UID_FIELD  '1000'
MYSQL_GID_FIELD  '1000'
# vi /var/www/extsuite/extman/webman.cf
SYS_DEFAULT_UID = 1000
SYS_DEFAULT_GID = 1000
# vi /etc/httpd/conf/httpd.conf
User vmail
Group Vmail
# su - vmail #切换用户看看是否有问题,如果报错需执行下面的更改权限。
# chmod 644 /etc/passwd
# chmod 644 /etc/group
# chown vmail. /var/mailbox/ -R
# chmod 700 /var/mailbox/ -R
# chown vmail. /tmp/extma* -R
# chgrp postdrop /var/spool/postfix/maildrop/
# /etc/init.d/postfix restart
# /etc/init.d/courier-authlib restart
3.更改数据库用户的uid和gid
# mysql -p
mysql> update mailbox set uidnumber='1000';
mysql> update mailbox set gidnumber='1000';
mysql> flush privileges;
#tailf /var/log/maillog
Jan 15 17:30:13 mail postfix/pipe[11346]: 84F0C20145: to=, relay=maildrop, delay=0.1, delays=0.04/0/0/0.06, dsn=2.0.0, status=sent (delivered via maildrop service)
Jan 15 17:30:13 mail postfix/qmgr[3156]: 84F0C20145: removed
注解:relay=maildrop,status=sent表示发送成功。
4.错误解决
Jan 15 01:45:56 mail9 postfix/pipe[31783]: fatal: get_service_attr: unknown username: vmail
解决办法:切换用户vmail,测试是否能够登录。如果出现下面说明正常。
# maildrop -V 10 -d [email protected]
maildrop: authlib: groupid=1000
maildrop: authlib: userid=1000
maildrop: authlib: [email protected], home=/var/mailbox/meihua.info/charlie.cen, mail=/var/mailbox/meihua.info/charlie.cen/Maildir/
maildrop: Changing to /var/mailbox/meihua.info/charlie.cen