-----------dovecot+mysql--------
dovecot:作为imap和pop3的服务器,作为IMAP和POP3服务器,dovecot为邮件用户代理(MUA)提供了一种访问服务器上存储的邮件的方法。但是,Dovecot并不负责从其他邮件服务器接收邮件。Dovecot只是将已经存储在邮件服务器上的邮件通过MUA显示出来。
[root@westos-mail ~]# vim /etc/dovecot/dovecot.conf
24 protocols = imap pop3 lmtp ####支持收件协议
49 disable_plaintext_auth = no ####开启明文认证
123 !include auth-sql.conf.ext ####开启mysql的认证方式
[root@westos-mail ~]# cp /usr/share/doc/dovecot-2.2.10/example-config/dovecot-sql.conf.ext /etc/dovecot/dovecot-sql.conf.ext ####生成dovecot读取mysql的配置
[root@westos-mail ~]# vim /etc/dovecot/dovecot-sql.conf.ext
32 driver = mysql ####数据库类型
71 connect = host=localhost dbname=email user=postuser password=postuser ####查询时用到的库,用户,密码
78 default_pass_scheme = PLAIN ####默认认证方式为明文
108 SELECT username, domain, password \
109 FROM emailuser WHERE username = '%u' AND domain = '%d'
125 user_query = SELECT maildir, 666 AS uid, 666 AS gid FROM emailuser WHERE username = '%u' ####查询邮件内容
[root@westos-mail ~]# vim /etc/dovecot/conf.d/10-mail.conf
30 mail_location = maildir:/home/vmail/%d/%n ###指定邮件位置
175 first_valid_gid = 666
Trying 172.25.254.242...
Connected to 172.25.254.242.
Escape character is '^]'.
+OK [XCLIENT] Dovecot ready.
user lee@qq.com #####输入后回车,出现ok字样,表明正确
+OK
pass lee ####pass后接数据库中lee@lee.com的密码
+OK Logged in.
quit
+OK Logging out.
Connection closed by foreign host.