首先一樣要安裝Postfix套件:#yum -y install postfix dovecot
編修目錄檔:
#vim /etc/postfix/main.cf myhostname = mail.example.com mydomain = example.com myorigin = $mydomain mynetworks_style = class mynetworks = 127.0.0.0/8, 192.168.100.0/24(打本機網段即可) inet_interfaces = all mydestination = $mydomain, $myhostname, localhost.$mydomain, localhost mail_spool_directory = /var/mail home_mailbox = Maildir/ mailbox_size_limit = 0 #原設定參數沒有 message_size_limit = 0 #請自己加上即可
換編修這個目錄檔:
#vim /etc/dovecot/dovecot.conf
protocols = imap pop3
編修設定檔:#vim /etc/dovecot/conf.d/10-mail.conf mail_location = mbox:~/mail:INBOX=/var/mail/%u
開啟防火牆服務:
#firewall-cmd --permanent --add-service=smtp #firewall-cmd --permanent --add-port=110/tcp #firewall-cmd --permanent --add-port=143/tcp #firewall-cmd --reload設定 SELinux :
#setsebool -P postfix_local_write_mail_spool on
啟動 smtp 與 imap 的服務:
檢測mail可否發送出去(我就是掛在這邊XD):#systemctl enable postfix #systemctl enable dovecot #systemctl start postfix #systemctl start dovecot
#mail student@mail.example.com Subject: test Hello World! .(PS "."是結束的意思)查看一下的記錄:
#tail /var/log/maillog