局域网搭建mail server(postfix+dovecot)

  1. 配置DNS服务器
  2. 安装postfix和dovecot
    yum install postfix dovecot -y
  3. 修改/etc/postfix/main.cf
myhostname = mail.ntp.com          # 设置服务器主机名
mydomain = ntp.com        # 设置服务器域名
myorigin = $mydomain        # 定义寄出邮件的域
mydestination = $myhostname, $mydomain        #定义可接收邮件的主机名或域名列表
inet_inteerfaces = all        # 对外提供访问权限
重启postfix服务和开机自启
systemctl restart postfix && systemctl enable postfix
  1. 修改/etc/dovecot/dovecot.conf
protocols = imap pop3 lmtp        # 电邮协议
disable_plaintext_auth = no         # 允许明文登录
  1. 修改`/etc/dovecot/conf.d/10-mail.conf
mail_location = mbox:~/mail:INBOX = /var/mail/%u
  1. 创建邮件用户及存放目录
useradd  user
su - user
mkdir -p mail/.imap/INBOX

7.重启dovecot服务和开机自启

systemctl restart dovecot && systemctl enable dovecot
  1. 发邮件测试
echo "this is a the test mail" | mail -s "test test test!" user@ntp.com
# 若是命令不存在,则需安装mail及其依赖
yum -y install sendmail
yum -y install mailx

一些坑啊,若是本机测试无误,局域网内另外及其无法使用,则需下面如下配置

# 修改 /etc/dovecot/conf.d/10-auth.conf
disable_plaintext_auth = no
# 修改/etc/dovecot/conf.d/10-ssl.conf
ssl = no
# 最后重启各个服务
```+
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容