環境:
yum install dovecot dovecot-mysql -y
yum install dovecot* -y
chkconfig docevot on(注意這次實驗與上次實驗有必定的關係)
步驟:
(1)vi /etc/dovecot/conf.d/10-mail.conf
mail_location = maildir:/home/vmail/%d/%n
first_valid_uid = 600
(2) vi /etc/dovecot/conf.d/10-auth.conf
!include auth-system.conf.ext
!include auth-sql.conf.ext
(3)cp /usr/share/doc/dovecot-2.0/example-config/dovecot-sql.conf.ext /etc/dovecot/
vi /etc/dovecot/dovecot-sql.conf.ext
# Database driver: mysql, pgsql, sqlite
driver = mysql
default_pass_scheme = PLAIN
# Examples:
# connect = host=192.168.1.1 dbname=users
connect = host=localhost dbname=sushan user=vmail password=vmail
# connect = /etc/dovecot/authdb.sqlite
注意:connect = host=localhost dbname=sushan user= vmail password=vmail
(注意host=localhost之間沒有空格哦,不然不成功的)
password_query = \
SELECT username, domain, password \
FROM sushanshan WHERE username = '%u'(該句也可一寫成FROM sushanshan(表名) WHERE username = '%u' AND domain = ‘%d’)
# Examples:
user_query = SELECT mailbox, 600 AS uid, 600 AS gid FROM sushanshan WHERE username = '%u'
(4)/etc/init.d/dovecot restart
netstat -antlp 會看到與dovecot相關的端口四個。
測試:
telnet localhost 110
出現OK說明成功。
user test@westos.org
+OK
pass sushan
+OK logged in
list
+OK 1/0 message
quit(退出)
(5) yum install thunderbird -ymysql