dovecot+mysql

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了dovecot+mysql相关的知识,希望对你有一定的参考价值。

dovecot+mysql

 

 

配置

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

2 vim /etc/dovecot/conf.d/10-auth.conf ###编辑认证文件###

 

内容:

123 !include auth-sql.conf.ext###支持mysql认证###

 

3 cp /usr/share/doc/dovecot-2.2.10/example-config/dovecot-sql.conf.ext /etc/dovecot/dovecot-sql.conf.ext###生成dovecot读取mysql的配置###

 

4  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‘###查询邮件内容###

 

5 vim /etc/dovecot/conf.d/10-mail.conf

 

内容:

168 first_valid_uid = 666###邮件文件查询用户身份###

175 first_valid_gid = 666

30 mail_location = maildir:/home/vmail/%d/%n###指定邮件位置###

 

6  systemctl restart dovecot.service

 

 

测试

[[email protected] Desktop]# telnet 172.25.254.112 110

Trying 172.25.254.112...

Connected to 172.25.254.112.

Escape character is ‘^]‘.

+OK [XCLIENT] Dovecot ready.

user [email protected]

+OK

pass lee

+OK Logged in.

quit

+OK Logging out.

Connection closed by foreign host.

 

thunderbird中可以直接测试:

 

技术分享

技术分享

技术分享

技术分享

技术分享


 

 

 

 

空壳邮件

 

1 )null客户端

 

1 vim /etc/postfix/main.cf

 

内容:

 

mydomain = example.com###域名###

myorigin = westos.com###伪装为真实邮件服务器的所在域###

myhostname = mail.example.com###主机名###

mydestination =###为空,不接受邮件###

relayhost = 172.25.254.112###转发给真实的邮件服务器###

 

 

2 systemctl restart postfix.service

 

 

3 测试:

 

空壳邮件服务器:

[[email protected] ~]# mail [email protected]

Subject: dskjaf

skdja

.

EOT

[[email protected] ~]# mailq

Mail queue is empty

[[email protected] ~]# mail

No mail for root

 

真实的邮件服务器###

[[email protected] ~]# mail

Heirloom Mail version 12.5 7/5/10.  Type ? for help.

"/var/spool/mail/root": 3 messages 3 new

>N  1 root                  Sat May 27 23:23  21/753   "hfue"

 N  2 root                  Sat May 27 23:23  21/757   "hjk"

 N  3 root                  Sat May 27 23:24  21/752   "dskjaf"

& 3

Message  3:

From [email protected]  Sat May 27 23:24:11 2017

Return-Path: <[email protected]>

X-Original-To: [email protected]

Delivered-To: [email protected]

Date: Sat, 27 May 2017 23:24:08 -0400

To: [email protected]

Subject: dskjaf

User-Agent: Heirloom mailx 12.5 7/5/10

Content-Type: text/plain; charset=us-ascii

From: [email protected] (root)

Status: R

 

skdja

 

& q

Held 3 messages in /var/spool/mail/root

 


以上是关于dovecot+mysql的主要内容,如果未能解决你的问题,请参考以下文章

dovecot+mysql

dovecot+mysql

邮件 dovecot

dovecot+mysql

dovecot+mysql 收件服务 和 空壳邮件

dovecot+mysql 收件服务空壳邮件