Postfix 拒绝地址

Postfix 拒绝地址

我正在尝试在 ubuntu 上设置 postfix。我只想允许从本地连接发送电子邮件而无需身份验证。当我尝试发送电子邮件时,我收到以下错误:

550 5.1.1 <[email protected]>: Recipient address rejected: gmail.com
554 5.5.1 Error: no valid recipients

无论将目标地址设置为何值,都会发生此错误。我已经使用以下方法进行了测试:

# telnet localhost 25

Trying ::1...
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
220 server.domain.com ESMTP Postfix (Ubuntu)

ehlo localhost
mail from: root@localhost
rcpt to: [email protected]
data
Subject: My first mail on Postfix

Hi,
Are you there?
regards,
Admin
.
quit250-server.domain.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
250 2.1.0 Ok
550 5.1.1 <[email protected]>: Recipient address rejected: gmail.com
554 5.5.1 Error: no valid recipients
221 2.7.0 Error: I can break rules, too. Goodbye.
Connection closed by foreign host.

我的 main.cf 文件如下所示:

# Debian specific:  Specifying a file name will cause the first
# line of that file to be used as the name.  The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname

smtpd_banner = $myhostname ESMTP $mail_name (Ubuntu)
biff = no

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

# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h

readme_directory = no

# 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 = server.domain.comt
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = server.domain.com, localhost
relayhost =
mynetworks = 127.0.0.0/8
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = loopback-only
default_transport = error
relay_transport = error
inet_protocols = ipv4

不确定如何继续,因为谷歌没有找到任何与我的问题相关的内容。

答案1

通常这是主机名/DNS问题。我假设server.domain.com不是服务器的实际主机名,但请确保它是正确的FQDN。如果它不是具有真实外部主机名的面向互联网的服务器,请使用.local域(我有时在家中使用.internal以避免与zeroconf冲突)。检查您的主机文件,/etc/hostname,/etc/mailname以及myhostname,mydestination,myorigin的值。

另外,上面的配置中,myhostname 有一个拼写错误。

相关内容