将 Postfix 配置为仅发送邮件服务器(454 4.7.1 中继访问被拒绝)

将 Postfix 配置为仅发送邮件服务器(454 4.7.1 中继访问被拒绝)

我正在将 Postfix 配置为我们组织的 SMTP 服务器,以便我们可以使用它从网站上的各种应用程序发送邮件,这些邮件超出了我们的 G Suite 托管邮件发送限制。(每天 10,000 封邮件)

但是,我在实际传递邮件时遇到了问题。我只希望 Postfix 将邮件发送到我们域之外。我不想要本地收件箱。我按如下方式配置它:

/etc/postfix/main.cf

smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no

# appending .domain is the MUA's job.
append_dot_mydomain = no

readme_directory = no

# See http://www.postfix.org/COMPATIBILITY_README.html -- default to 2 on
# fresh installs.
compatibility_level = 2

# TLS parameters
smtpd_tls_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
smtpd_tls_key_file=/etc/ssl/private/ssl-cert-snakeoil.key
smtpd_use_tls=yes
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache

# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.

myhostname = mailrelay.domain
mydomain = domain

myorigin = $mydomain
mydestination =
mynetworks =
relayhost =
inet_interfaces = all
inet_protocols = all

通过阅读 Postfix 手册和一些文章,我得出结论,我保留我的目的地空白,因为不应有要传送到的本地域,并且我的网络留空,因为我希望它能从我指向的任何主机发送邮件。但是,当我尝试发送邮件时,出现以下错误,声称“中继访问被拒绝:”

Dec 30 13:34:41 mailrelay postfix/smtpd[2057]: connect from localhost[::1]
Dec 30 13:35:06 mailrelay postfix/smtpd[2057]: NOQUEUE: reject: RCPT from localhost[::1]: 454 4.7.1 <[email protected]>: Relay access denied; from=<test@domain> to=<[email protected]> proto=SMTP
Dec 30 13:37:28 mailrelay postfix/smtpd[2057]: lost connection after RCPT from localhost[::1]
Dec 30 13:37:28 mailrelay postfix/smtpd[2057]: disconnect from localhost[::1] mail=1/2 rcpt=0/1 commands=1/3

这是因为我设置了我的网络变成空白?所以它现在正在尝试“转发”邮件?现在smtpd_relay_restrictions正在阻止它吗?

我希望发送到此 SMTP 服务器的所有邮件都直接发送到目的地。研究后,我发现我需要启用 SASL 身份验证,以便非本地主机可以使用用户名/密码组合进行身份验证以发送邮件。这是正确的配置吗?我理解上述错误正确吗?我的下一步是什么?

相关内容