实验一:
环境:
  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 -y