CentOS下使用Postfix + Dovecot + Dnsmasq搭建極簡區域網路郵件系統

來源:互聯網
上載者:User

標籤:start   生效   word   需要   pos   補全   main   設定   完整   

背景

開發環境為區域網路,工作內容需要經常查看郵件檔案(*.eml),可惡的Foxmail必須驗證賬戶才能進入主介面,才能開啟eml檔案查看。

無奈搭一個區域網路內的郵件系統吧。極簡搭建,僅用於通過Foxmail驗證。

 

環境
[[email protected] ~]# cat /etc/redhat-release CentOS Linux release 7.2.1511 (Core)

 

安裝

下載伺服器軟體:

SMTP伺服器postfix

POP/IMAP伺服器dovecot

DNS伺服器dnsmasq

[[email protected] ~]# yum -y install dovecot postfix dnsmasq

 

版本資訊

[[email protected] ~]# rpm -qi dovecotName        : dovecotEpoch       : 1Version     : 2.2.10Release     : 5.el7
[[email protected] ~]# rpm -qi dnsmasqName : dnsmasqVersion : 2.66Release : 14.el7_2.1
[[email protected] ~]# rpm -qi postfixName : postfixEpoch : 2Version : 2.10.1Release : 6.el7

 

配置hostname

[[email protected] ~]# vim /etc/hostname

這裡更改為

mail.nidey.com

 

重啟生效

[[email protected] ~]# reboot

 

配置dnsmasq

在hosts檔案中增加 本地IP<==>網域名稱 映射

[[email protected] ~]# vim /etc/hosts

填入如下內容

192.168.118.101 mail.nidey.com

 

實驗用,dnsmasq不用做其他配置,預設使用/etc/hosts作位址解析(相當於在區域網路內共用了這個檔案)。

[[email protected] ~]# systemctl start dnsmasq[[email protected] ~]# systemctl enable dnsmasq

 

配置postfix

[[email protected] ~]# vim /etc/postfix/main.cf

取消注釋並設定myhostname、mydomain、myorigin、inet_interfaces、inet_protocols、mydestination,

內容如下

myhostname = mail.nidey.commydomain = nidey.commyorigin = $mydomaininet_interfaces = all
inet_protocols = ipv4mydestination = $myhostname, $mydomain

 

啟動伺服器

[[email protected] ~]# systemctl start postfix[[email protected] ~]# systemctl enable postfix

 

配置dovecot

[[email protected] ~]# vim /etc/dovecot/dovecot.conf

取消注釋並設定listen(只啟用IPv4郵件服務)

設定登入信任網路(可使用明文驗證密碼)

listen = *login_trusted_networks = 0.0.0.0/0

 

設定郵件檔案位置

[[email protected] ~]# vim /etc/dovecot/conf.d/10-mail.conf

取消注釋,並設定

mail_location = mbox:~/mail:INBOX=/var/mail/%u

 

建立郵件賬戶

這裡使用本地系統賬戶,建立賬戶ted、密碼ted

[[email protected] ~]# useradd ted[[email protected] ~]# echo ted | passwd --stdin tedChanging password for user ted.passwd: all authentication tokens updated successfully.

 

建立ted賬戶的郵件檔案夾

[[email protected] ted]# su ted[[email protected] ~]$ cd ~[[email protected] ~]$ mkdir -p mail/.imap/INBOX[[email protected] ~]$ su rootPassword: [[email protected] ted]# 

 

啟動服務

[[email protected] ~]# systemctl start dovecot[[email protected] ~]# systemctl enable dovecot

  

使用

郵件伺服器IP -->192.168.118.101

XP 用戶端IP  -->192.168.118.10

以下在XP機器上操作

配置DNS

 

 

使用了FoxMail用戶端

POP協議登入

 

寫郵件給自己

 

POP協議收郵件

 

IMAP協議登入

 

IMAP協議收郵件

 

差不多就這樣了,以後再補全完整點的郵件、DNS系統。

 

特別感謝

《Linux就該這麼學》

 

CentOS下使用Postfix + Dovecot + Dnsmasq搭建極簡區域網路郵件系統

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.