virtual_mailbox_domains = mysql:/etc/postfix/mysql_virtual_domains_maps.cf # 定义虚拟邮箱能够接受哪些域名,域名的信息保存在mysql里 virtual_transport = maildrop: # 定义使用哪个 程序进行邮件的投递操作
重启 postfix
[root@mail docs]# /etc/init.d/postfix restart
测试:
[root@mail docs]# /usr/sbin/authtest -s login postmaster@extmail.org extmail Authentication succeeded.
Authenticated: postmaster@extmail.org (uid 1000, gid 1000) Home Directory: /home/domains/extmail.org/postmaster
Maildir: /home/domains/extmail.org/postmaster/Maildir/ Quota: 104857600S
Encrypted Password: $1$phz1mRrj$3ok6BjeaoJYWDBsEPZb5C0 Cleartext Password: extmail Options: (none) 成功了!
客户端登录测试:
后台管理:
http://mail.extmail.org/extman/ root@extmail.org extmail*123*
前台界面:
http://mail.extmail.org/extmail/ 可能出现的问题及解答 排错: (1)
[root@mail ~]# /usr/sbin/authtest -s login postmaster@extmail.org extmail Authentication FAILED: Input/output error
[root@mail ~]# vim /etc/authlib/authmysqlrc
(2)
[root@mail ~]# /usr/sbin/authtest -s login postmaster@extmail.org extmail Authentication FAILED: Operation not permitted
[root@mail ~]# /etc/init.d/courier-authlib restart
[root@mail ~]# tail -0f /var/log/maillog
Sep 13 02:36:04 localhost authdaemond: stopping authdaemond children Sep 13 02:36:04 localhost authdaemond: modules=\Sep 13 02:36:04 localhost authdaemond: Installing libauthmysql
Sep 13 02:36:04 localhost authdaemond: libauthmysql.so: cannot open shared object file: No such file or directory
[root@mail ~]# yum provides */libauthmysql.so
[root@mail ~]# yum install -y courier-authlib-mysql
查看邮件队列:
[root@mail docs]# mailq Mail queue is empty
查看日志: /var/log/maillog
清空邮件队列: postsuper -d ALL postsuper -d Queue_ID
=========================== 配置sasl认证机制:
===========================
[root@mail docs]# yum install -y cyrus-sasl-sql
[root@mail docs]# cp mysql_virtual_sender_maps.cf /etc/postfix/ 编辑配置文件
[root@mail docs]# vim /etc/postfix/main.cf
smtpd_recipient_restrictions=
permit_mynetworks,permit_sasl_authenticated,reject_non_fqdn_hostname,reject_non_fqdn_sender,reject_non_fqdn_recipient,reject_unauth_destination,reject_unauth_pipelining,reject_invalid_hostname
smtpd_sender_restrictions=
permit_mynetworks,reject_sender_login_mismatch,reject_authenticated_sender_login_mismatch,reject_unauthenticated_s ender_login_mismatch
smtpd_sender_login_maps=
mysql:/etc/postfix/mysql_virtual_sender_maps.cf,mysql:/etc/postfix/mysql_virtual_alias_maps.cf
broken_sasl_auth_clients = yes smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = $myhostname smtpd_sasl_security_options = noanonymous
编辑配置文件
[root@mail docs]# vim /usr/lib/sasl2/smtpd.conf pwcheck_method: authdaemond log_level: 3
mech_list: PLAIN LOGIN
authdaemond_path:/var/spool/authdaemon/socket
[root@mail docs]# ls /var/spool/authdaemon/socket /var/spool/authdaemon/socket
启动验证的服务
[root@mail docs]# /etc/init.d/saslauthd restart
测试: 使用注册过的帐户
[root@mail extmail.org]# pwd /home/domains/extmail.org
[root@mail extmail.org]# ls a1 a2 q1 全名:a1@extmail.org
生成用户的 Base64 位编码:
[root@mail ~]# perl -e 'use MIME::Base64; print encode_base64(\YTFAZXh0bWFpbC5vcmc=
[root@mail ~]# perl -e 'use MIME::Base64; print encode_base64(\YTJAZXh0bWFpbC5vcmc=
生成用户的登录密码的 Base64位编码:
[root@mail ~]# perl -e 'use MIME::Base64; print encode_base64(\MTIz
[root@mail ~]# telnet mail.extmail.org 25 Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1). Escape character is '^]'.
220 mail.extmail.org MySMTP My_Postfix helo mail.extmail.org 手写 250 mail.extmail.org
auth login 手写 334 VXNlcm5hbWU6
YTFAZXh0bWFpbC5vcmc= 用户 a1@extmail.org 的编码 334 UGFzc3dvcmQ6 MTIz 用户 a1@extmail.org 的密码 235 2.7.0 Authentication successful mail from:a1@extmail.org 发信人 250 2.1.0 Ok
rcpt to:a2@extmail.org 收信人 250 2.1.5 Ok data 开始写 信的正文
354 End data with
250 2.0.0 Ok: queued as 758D0706EE quit 退出 221 2.0.0 Bye
Connection closed by foreign host.
===================== 配置收邮件的工具 imap
安装所需的软件
[root@mail ~]# yum install -y courier-imap 改变所需的功能
[root@mail ~]# vim +414 /usr/lib/courier-imap/etc/imapd IMAPDSTART=NO
[root@mail ~]# vim +75 /usr/lib/courier-imap/etc/imapd-ssl IMAPDSSLSTART=NO
[root@mail ~]# /etc/init.d/courier-imap restart
Stopping Courier-IMAP server: imap imap-ssl pop3 pop3-ssl
Starting Courier-IMAP server: pop3 generating-SSL-certificate... pop3-ssl
测试:
[root@mail ~]# telnet mail.extmail.org 110 Trying 127.0.0.1...
Connected to localhost.localdomain (127.0.0.1). Escape character is '^]'. +OK Hello there.
user a2@extmail.org 用户名 +OK Password required. pass 123 密码
+OK logged in. list 查看邮件列表
+OK POP3 clients that break here, they violate STD53. 1 435 . stat 查看最新的邮件 +OK 1 435 top 1 435 查看信的内容 +OK headers follow.
Return-Path:
Received: from mail.extmail.org (mail.extmail.org [127.0.0.1])
by mail.extmail.org (My_Postfix) with SMTP id 758D0706EE for
Message-Id: <20130913080106.758D0706EE@mail.extmail.org> Date: Fri, 13 Sep 2013 16:00:55 +0800 (CST) From: a1@extmail.org To: undisclosed-recipients:;
chi fan mei?

