|NO.Z.00072|——————————|^^ 部署 ^^|——|Linux&企业邮件.V03|——|client配置|
一、接收方配置:安装dovecot相关软件
### --- 安装dovecot相关软件
[root@server21 ~]# yum install -y dovecot dovecot-devel dovecot-mysql
[root@server21 ~]# chkconfig dovecot on
[root@server21 ~]# service dovecot start
二、配置dovecot能够去数据库里读数据
### --- 配置dovecot能够去数据库里读数据
### --- 修改/etc/dovecot/conf.d/10-mail.conf
~~~ 在配置文件中增加下列两行
[root@server21 ~]# vim /etc/dovecot/conf.d/10-mail.conf
mail_location = maildir:/home/vmail/%d/%n/Maildir // 定义dovecot查询邮件的位置(顶头写)
first_valid_uid = 600
### --- 修改/etc/dovecot/conf.d/10-auth.conf
[root@server21 ~]# vim /etc/dovecot/conf.d/10-auth.conf
!include auth-system.conf.ext
!include auth-sql.conf.ext // 取消调用数据库的记录注释
### --- 修改数据库连接配置文件(需要拷贝模板生成)
[root@server21 ~]# cp -a /usr/share/doc/dovecot-2.0.9/example-config/dovecot-sql.conf.ext /etc/dovecot/
[root@server21 ~]# vim /etc/dovecot/dovecot-sql.conf.ext // 将下列内容加入配置文件即可
driver = mysql
~~~ 驱动类型
connect = host=localhost dbname=extmail user=extmail password=extmail
~~~ 连接数据库信息
default_pass_scheme = MD5
password_query = \
SELECT username, domain, password \
FROM mailbox WHERE username = '%u' AND domain = '%d'
~~~ 验证登录密码的查询命令
user_query = SELECT maildir, 600 AS uid, 600 AS gid FROM mailbox WHERE username = '%u'
~~~ 查询虚拟用户对应的邮箱目录
三、重启dovecot验证是否能连接
### --- 重启dovecot验证是否能连接
### --- 安装Telnet客户端进行登录验证
[root@server21 ~]# service dovecot restart
[root@server21 ~]# yum install -y telnet
[root@server21 ~]# netstat -antp
tcp 0 0 0.0.0.0:110 0.0.0.0:* LISTEN 2962/dovecot
[root@server21 ~]# telnet mail.extmail.org 110
Trying 20.20.20.21...
Connected to mail.extmail.org.
Escape character is '^]'.
+OK Dovecot ready. // 登录成功;在此基础下执行命令
user postmaster@extmail.org // 登录postmaster用户
+OK
pass extmail // 密码是extmail;若是可以连接数据库说明没有问题
+OK Logged in.
retr 1 // 查看第一封邮件
+OK 560 octets
Return-Path: <root@server21.localdomain>
X-Original-To: support@extmail.org
Delivered-To: postmaster@extmail.org
Received: by server21.localdomain (Postfix, from userid 0)
id 37705480A19; Thu, 4 Feb 2021 09:41:44 +0800 (CST)
Date: Thu, 04 Feb 2021 09:41:44 +0800
To: support@extmail.org
Subject: test
User-Agent: Heirloom mailx 12.4 7/29/08
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Message-Id: <20210204014144.37705480A19@server21.localdomain>
From: root@server21.localdomain (root)
hello
.
quit
+OK Logging out. // 登出
Connection closed by foreign host.
Walter Savage Landor:strove with none,for none was worth my strife.Nature I loved and, next to Nature, Art:I warm'd both hands before the fire of life.It sinks, and I am ready to depart
——W.S.Landor
分类:
cdv007-network
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 无需6万激活码!GitHub神秘组织3小时极速复刻Manus,手把手教你使用OpenManus搭建本
· Manus爆火,是硬核还是营销?
· 终于写完轮子一部分:tcp代理 了,记录一下
· 别再用vector<bool>了!Google高级工程师:这可能是STL最大的设计失误
· 单元测试从入门到精通