Postfix 邮件服务器无法向外部服务器发送邮件

Postfix 邮件服务器无法向外部服务器发送邮件

我已经在我的 Ubuntu 18.04 服务器上设置了 postfix 和 dovecot 以及 roundcube,现在我可以接收到发送到我的服务器的电子邮件,但我似乎无法向外部服务器发送邮件(内部发送的邮件工作正常)。

Postfix 配置:

alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
compatibility_level = 2
inet_interfaces = all
inet_protocols = all
mailbox_size_limit = 0
mydestination = localhost.$mydomain, localhost, localhost.localdomain
myhostname = abc.exampleDomain.com
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
myorigin = /etc/mailname
readme_directory = no
recipient_delimiter = +
relayhost =
smtp_tls_security_level = may
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtp_use_tls = yes
smtpd_banner = $myhostname ESMTP $mail_name
smtpd_relay_restrictions = permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_path = private/auth
smtpd_sasl_type = dovecot
smtpd_tls_cert_file = /etc/letsencrypt/live/exampleDomain.com/fullchain.pem
smtpd_tls_key_file = /etc/letsencrypt/live/exampleDomain.com/privkey.pem
smtpd_tls_security_level = may
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_use_tls = yes
virtual_mailbox_domains = /etc/postfix/virtual_mailbox_domains
virtual_transport = lmtp:unix:private/dovecot-lmtp

master.cf:

smtp      inet  n       -       y       -       -       smtpd

submission inet n       -       y       -       -       smtpd
  -o smtpd_tls_security_level=encrypt
  -o smtpd_sasl_auth_enable=yes
  -o smtpd_client_restrictions=permit_sasl_authenticated,reject

smtps     inet  n       -       n       -       -       smtpd
  -o smtpd_tls_wrappermode=yes
  -o smtpd_sasl_auth_enable=yes
  -o smtpd_client_restrictions=permit_sasl_authenticated,reject

并且日志(/var/log/mail.log)仅显示以下模糊的连接超时错误消息:

Jul 18 20:33:45 abc postfix/smtp[32547]: 7419223465: to=<[email protected]>, relay=none, delay=30, delays=0.05/0.02/30/0, dsn=4.4.1, status=deferred (connect to example.com[xx.xx.xx.xx]:25: Connection timed out)

我在 Postfix/Dovecot 设置过程中做错了什么?


其他一些信息:

telnet 127.0.0.1 25返回以下内容:

Trying 127.0.0.1...
Connected to 127.0.0.1.
Escape character is '^]'.
220 abc.exampleDomain.com ESMTP Postfix

ls -l /var/spool/postfix/private返回以下内容:

srw-rw-rw- 1 postfix postfix 0 Jul 18 10:42 anvil
srw-rw-rw- 1 postfix postfix 0 Jul 18 10:42 auth
srw-rw-rw- 1 postfix postfix 0 Jul 18 10:42 bounce
srw-rw-rw- 1 postfix postfix 0 Jul 18 10:42 bsmtp
srw-rw-rw- 1 postfix postfix 0 Jul 18 10:42 defer
srw-rw-rw- 1 postfix postfix 0 Jul 18 10:42 discard
srw------- 1 postfix postfix 0 Jul 18 10:42 dovecot-lmtp
srw-rw-rw- 1 postfix postfix 0 Jul 18 10:42 error
srw-rw-rw- 1 postfix postfix 0 Jul 18 10:42 ifmail
srw-rw-rw- 1 postfix postfix 0 Jul 18 10:42 lmtp
srw-rw-rw- 1 postfix postfix 0 Jul 18 10:42 local
srw-rw-rw- 1 postfix postfix 0 Jul 18 10:42 maildrop
srw-rw-rw- 1 postfix postfix 0 Jul 18 10:42 mailman
srw-rw-rw- 1 postfix postfix 0 Jul 18 10:42 proxymap
srw-rw-rw- 1 postfix postfix 0 Jul 18 10:42 proxywrite
srw-rw-rw- 1 postfix postfix 0 Jul 18 10:42 relay
srw-rw-rw- 1 postfix postfix 0 Jul 18 10:42 retry
srw-rw-rw- 1 postfix postfix 0 Jul 18 10:42 rewrite
srw-rw-rw- 1 postfix postfix 0 Jul 18 10:42 scache
srw-rw-rw- 1 postfix postfix 0 Jul 18 10:42 scalemail-backend
srw-rw-rw- 1 postfix postfix 0 Jul 18 10:42 smtp
srw-rw-rw- 1 postfix postfix 0 Jul 18 10:42 tlsmgr
srw-rw-rw- 1 postfix postfix 0 Jul 18 10:42 trace
srw-rw-rw- 1 postfix postfix 0 Jul 18 10:42 uucp
srw-rw-rw- 1 postfix postfix 0 Jul 18 10:42 verify
srw-rw-rw- 1 postfix postfix 0 Jul 18 10:42 virtual

相关内容