##############dovecot+mysql############
1.
yum install dovecotdovecot-mysql.x86_64 -y
####dovecot dovecot-mysql 软件的安装,dovecot-mysql dovecot 软件的插件,让此软件可以识别mysql
2.配置文件
(1)vim /etc/dovecot/dovecot.conf
24 protocols = imap pop3 lmtp ###支持收件协议
48 login_trusted_networks =0.0.0.0/0##信任网络
49 disable_plaintext_auth = no ###开启明文认证
(2)vim /etc/dovecot/conf.d/10-auth.conf
123 include auth-sql.conf.ext ##开启mysql的认证方式
(3)##生成dovecot读取mysql的配置
cp/usr/share/doc/dovecot-2.2.10/example-config/dovecot-sql.conf.ext/etc/dovecot/dovecot-sql.conf.ext ###复制配置文件模版
vim/etc/dovecot/dovecot-sql.conf.ext
32 driver = mysql ###数据库类型
71 connect = host=localhostdbname=email user=postuser password=postuser ###查询时用到的库,用户,密码
78 default_pass_scheme = PLAIN ###默认认证方式为明文
107 password_query = \ ###查询密码匹配
108 SELECT username, domain, password\
109 FROM emailuser WHERE username ='%u' AND domain = '%d'
125 user_query = SELECT maildir, 666AS uid, 666 AS gid FROM emailuser WHERE username = '%u' ###查询邮件内容
(4) vim /etc/dovecot/conf.d/10-mail.conf
30 mail_location=maildir:/home/vmail/%d/%n ##指定邮件位置
168 first_valid_uid = 666 ###邮件文件查询用户身份
175 first_valid_gid = 666
(5)systemctl restart dovecot
3.测试
(1)telnet 172.25.254.144 110
172 yum install dovecot -y
173 yum install dovecot-mysql -y
174 vim /etc/dovecot/dovecot.conf
24 protocols = imap pop3 lmtp
48 login_trusted_networks=0.0.0.0/0
49 disable_plaintext_auth = no
175 vim /etc/dovecot/conf.d/10-auth.conf
123 include auth-sql.conf.ext
176 cp /usr/share/doc/dovecot-2.2.10/example-config/dovecot-sql.conf.ext/etc/dovecot/dovecot-sql.conf.ext
177 vim /etc/dovecot/dovecot-sql.conf.ext
32 driver = mysql ###数据库类型
71 connect = host=localhostdbname=email user=postuser password=postuser ###查询时用到的库,用户,密码
78 default_pass_scheme = PLAIN ###默认认证方式为明文
107 password_query = \ ###查询密码匹配
108 SELECT username, domain, password\
109 FROM emailuser WHERE username ='%u' AND domain = '%d'
125 user_query = SELECT maildir, 666AS uid, 666 AS gid FROM emailuser WHERE username = '%u' ###查询邮件内容
178 vim /etc/dovecot/conf.d/10-mail.conf
30 mail_location=maildir:/home/vmail/%d/%n ##指定邮件位置
168 first_valid_uid = 666 ###邮件文件查询用户身份
175 first_valid_gid = 666
179 systemctl restart dovecot
########空壳邮件########
重置一台主机,配置网络。修改主机名称。
server:
1 hostnamectl set-hostname nullmail.example.com
2 hostname
3 logout
4 vim /etc/postfix/main.cf
75 myhostname = nullmail.example.com
83 mydomain = example.com
99 myorigin = westos.com
112 inet_interfaces = all
163 mydestination =
316 relayhost = 172.25.254.144
5 systemctl restart postfix.service
测试:
6 mail root
7 mailq
8 mail
配置DNS:
[root@westos-mail ~]# vim/etc/named.conf
[root@westos-mail ~]# vim/etc/named.rfc1912.zones
[root@westos-mail ~]# cd /var/named/
[root@westos-mail named]# ls
data named.ca named.loopback slaves
dynamic named.empty qq.com.zone westos.com.zone
example.com.zone named.localhost sb.com.zone
[root@westos-mail named]# vim example.com.zone
[root@westos-mail named]# systemctl restart named
[root@nullmail ~]# vim /etc/resolv.conf
[root@nullmail ~]# dig dns.example.com
[root@nullmail ~]# dig -t mx example.com