首頁文件分類網站建置CentOSCentOS 7.x 安裝 Postfix
CentOS 7.x 安裝 Postfix

The Postfix Home Page

http://www.postfix.org/


安裝 Postfix
yum -y install postfix cyrus-sasl cyrus-sasl-gssapi cyrus-sasl-ntlm cyrus-sasl-md5 cyrus-sasl-plain dovecot

編輯 dovecot 設定檔
vi /etc/dovecot/dovecot.conf
protocols = imap pop3

啟動 pop3
systemctl start dovecot
開機啟動
systemctl enable dovecot

啟動 saslauthd
systemctl start saslauthd
開機啟動
systemctl enable saslauthd

編輯 postfix 設定檔
vi /etc/postfix/main.cf
郵件主機名稱
myhostname = 主機名稱
郵件主機網域名稱
mydomain = 網域名稱
郵件主機發信來源
myorigin = $myhostname
要監聽的網路介面
inet_interfaces = all
要收信的網域名稱
mydestination = /etc/postfix/local-host-names
帳號對照表
virtual_alias_maps = hash:/etc/postfix/virtual
設定信任網域
mynetworks_style = host
規定信任的用戶端
mynetworks = 127.0.0.0/8, 192.168.0.0/24, hash:/etc/postfix/access
規範可以幫忙 relay 的下一部 MTA 主機位址
relay_domains = $mydestination
啟動 SMTP 認證
smtpd_sasl_auth_enable = yes
broken_sasl_auth_clients = yes
smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_security_options = noanonymous
smtpd_client_restrictions = permit_sasl_authenticated
smtpd_relay_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated

vi /etc/dovecot/conf.d/10-auth.conf
disable_plaintext_auth = no
auth_mechanisms = plain login

vi /etc/dovecot/conf.d/10-mail.conf
mail_location = mbox:~/mail:INBOX=/var/mail/%u

vi /etc/dovecot/conf.d/10-master.conf
service auth 區塊
#unix_listener auth-userdb
unix_listener /var/spool/postfix/private/auth {
  mode = 0666
  user = postfix
  group = postdrop
}

設定接收的網域
vi /etc/postfix/local-host-names
設定郵件帳號對應
vi /etc/postfix/virtual
轉換對照表
postmap /etc/postfix/virtual
postmap /etc/postfix/access

啟動服務
systemctl start postfix
開機啟動
systemctl enable postfix
首頁文件分類網站建置CentOSCentOS 7.x 安裝 Postfix