Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux基礎 >> 關於Linux

Postfix 郵件發送的基本配置

Postfix 是常見的郵件傳輸代理程式。若要讓主機具備基本的郵件發送能力,可先完成安裝,再設定主設定檔與 SMTP 認證。

安裝 Postfix

rpm -qa postfix
yum install postfix

編輯 main.cf

vim /etc/postfix/main.cf

主要設定範例:

myhostname = smtp.rhttp.cn
mydomain = rhttp.com
myorigin = $mydomain
inet_interfaces = all
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
relay_domains = $mydestination
mynetworks = 168.100.189.0/28, 127.0.0.0/8
home_mailbox = Maildir/
smtpd_banner = $myhostname ESMTP unknown

在設定檔尾端加入 SMTP 認證與限制:

smtpd_sasl_auth_enable = yes
smtpd_sasl_local_domain = $myhostname
smtpd_sasl_security_options = noanonymous
smtpd_recipient_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
message_size_limit = 15728640

設定 SMTP 認證

編輯 SASL 設定:

vim /usr/sasl2/smtpd.conf
pwcheck_method: auxprop

編輯 saslauthd 設定:

vim /etc/sysconfig/saslauthd
#MECH=shadow
FLAGS=sasldb

建立認證密碼

saslpasswd2 -u smtp.rhttp.cn -c reage

完成後重新啟動 Postfix 與相關服務,即可進行基本郵件發送測試。

Copyright © Linux教程網 All Rights Reserved