#####################
####dovecot+mysql####
#####################
1.安装

yum install dovecot dovecot-mysql -y   ##dovecot-mysql dovecot软件的插件,让此软件可以识别mysql

Linux--RH254---unit4 postfix2


2.配置
vim /etc/dovecot/dovecot.conf
 24 protocols = imap pop3 lmtp            ##支持收件协议
 48 login_trusted_networks = 0.0.0.0/0    ##信任网络
 49 disable_plaintext_auth = no           ##开启明文认证
Linux--RH254---unit4 postfix2

Linux--RH254---unit4 postfix2

vim /etc/dovecot/conf.d/10-auth.conf

123 !include auth-sql.conf.ext            ##开启mysql的认证方式
Linux--RH254---unit4 postfix2
cp /usr/share/doc/dovecot-2.2.10/example-config/dovecot-sql.conf.ext /etc/dovecot/dovecot-sql.conf.ext                      ##生成dovecot读取mysql的配置

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           ##默认认证方式为明文
107 password_query = \                    ##查询密码匹配
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'                           ##查询邮件内容
Linux--RH254---unit4 postfix2

Linux--RH254---unit4 postfix2

Linux--RH254---unit4 postfix2

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
Linux--RH254---unit4 postfix2

Linux--RH254---unit4 postfix2

systemctl restart dovecot

Linux--RH254---unit4 postfix2


3.测试:

yum install telnet -y

Linux--RH254---unit4 postfix2

telnet 172.25.254.131 110
Trying 172.25.254.131...
Connected to 172.25.254.131.
Escape character is '^]'.
+OK [XCLIENT] Dovecot ready.
user [email protected]
+OK
pass wang
+OK Logged in.
quit
+OK Logging out.

Connection closed by foreign host.

Linux--RH254---unit4 postfix2


###############

####空壳邮件####

###############

空壳端
vim /etc/postfix/main.cf                     ##编辑配置文件
 76 myhostname = nullmail.example.com        ##指定mta主机名称
 83 mydomain = example.com                    ##指定mta的域名
 99 myorigin = westos.com                     ##指定邮件来源结尾(@后面的字符内容)
116 inet_interfaces = all                    ##25端口开启的网络接口
164 mydestination =                          ##不接收任何邮件

316 relayhost = 172.25.254.131               ##指定真实的邮件服务器IP地址

Linux--RH254---unit4 postfix2

Linux--RH254---unit4 postfix2

Linux--RH254---unit4 postfix2

Linux--RH254---unit4 postfix2

systemctl restart postfix.service

Linux--RH254---unit4 postfix2

测试

mail [email protected]

Linux--RH254---unit4 postfix2

接收端

mail

Linux--RH254---unit4 postfix2

相关文章:

  • 2021-05-18
  • 2021-05-10
  • 2022-01-19
  • 2021-10-23
  • 2021-06-22
  • 2021-08-22
  • 2021-07-12
猜你喜欢
  • 2021-04-12
  • 2021-04-06
  • 2021-06-17
  • 2021-10-06
  • 2021-12-26
  • 2021-06-02
  • 2021-05-11
相关资源
相似解决方案