局域網(wǎng)搭建mail server(postfix+dovecot)

  1. 配置DNS服務(wù)器
  2. 安裝postfix和dovecot
    yum install postfix dovecot -y
  3. 修改/etc/postfix/main.cf
myhostname = mail.ntp.com          # 設(shè)置服務(wù)器主機名
mydomain = ntp.com        # 設(shè)置服務(wù)器域名
myorigin = $mydomain        # 定義寄出郵件的域
mydestination = $myhostname, $mydomain        #定義可接收郵件的主機名或域名列表
inet_inteerfaces = all        # 對外提供訪問權(quán)限
重啟postfix服務(wù)和開機自啟
systemctl restart postfix && systemctl enable postfix
  1. 修改/etc/dovecot/dovecot.conf
protocols = imap pop3 lmtp        # 電郵協(xié)議
disable_plaintext_auth = no         # 允許明文登錄
  1. 修改`/etc/dovecot/conf.d/10-mail.conf
mail_location = mbox:~/mail:INBOX = /var/mail/%u
  1. 創(chuàng)建郵件用戶及存放目錄
useradd  user
su - user
mkdir -p mail/.imap/INBOX

7.重啟dovecot服務(wù)和開機自啟

systemctl restart dovecot && systemctl enable dovecot
  1. 發(fā)郵件測試
echo "this is a the test mail" | mail -s "test test test!" user@ntp.com
# 若是命令不存在,則需安裝mail及其依賴
yum -y install sendmail
yum -y install mailx

一些坑啊,若是本機測試無誤,局域網(wǎng)內(nèi)另外及其無法使用,則需下面如下配置

# 修改 /etc/dovecot/conf.d/10-auth.conf
disable_plaintext_auth = no
# 修改/etc/dovecot/conf.d/10-ssl.conf
ssl = no
# 最后重啟各個服務(wù)
```+
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容