我在使用 postfix 和 dovecot 设置电子邮件服务器时遇到了一些问题。我已设置配置文件,但收到错误:
Nov 22 23:49:09 server postfix/smtpd[31487]: connect from unknown[*.*.*.*]
Nov 22 23:49:09 server postfix/smtpd[31487]: NOQUEUE: reject: RCPT from unknown[*.*.*.*]: 454 4.7.1 <[email protected]>: Relay access denied; from=<[email protected]> to=<[email protected]> proto=ESMTP helo=<[*.*.*.*]>
Nov 22 23:49:09 server postfix/smtpd[31487]: disconnect from unknown[*.*.*.*] ehlo=2 starttls=1 mail=1 rcpt=0/1 quit=1 commands=5/6
服务器可以成功接收来自外部来源的电子邮件并从控制台发送邮件。
这是我的postconf -n
:
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
inet_interfaces = all
inet_protocols = all
mailbox_size_limit = 0
mydestination = localhost
myhostname = mail.example.com
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
myorigin = /etc/mailname
readme_directory = no
recipient_delimiter = +
relayhost =
smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
smtpd_relay_restrictions = permit_mynetworks,permit_sasl_authenticated,defer_unauth_destination
smtpd_tls_auth_only = yes
smtpd_tls_cert_file = /etc/letsencrypt/live/example.com/cert.pem
smtpd_tls_key_file = /etc/letsencrypt/live/example.com/privkey.pem
smtpd_use_tls = yes
virtual_alias_maps = mysql:/etc/postfix/mysql-virtual-alias-maps.cf
virtual_mailbox_domains = mysql:/etc/postfix/mysql-virtual-mailbox-domains.cf
virtual_mailbox_maps = mysql:/etc/postfix/mysql-virtual-mailbox-maps.cf
virtual_transport = lmtp:unix:private/dovecot-lmtp
我尝试了各种方法限制 smtpd 收件人/中继,但都不起作用。如能得到任何帮助,我将不胜感激。
答案1
中继访问被拒绝是指 SMTP 身份验证错误。
当今大多数服务器不使用开放中继来发送,因此您应该检查邮件客户端配置以在 SMTP 服务器上进行身份验证。