Postfix / Dovecot / MySQL / Ubuntu 16.04 - 通过 IMAP 接收,但不发送

Postfix / Dovecot / MySQL / Ubuntu 16.04 - 通过 IMAP 接收,但不发送

我已经到了这样的地步,我想我已经读完了关于这个问题的每一篇帖子/文章,但还是卡住了。我对 Ubuntu 和 Linux 还比较陌生,但我一直在尝试一次解决一个问题。

现在的问题是它无法从外部电子邮件客户端发送电子邮件。我尝试通过 gmail 和 Outlook 应用程序链接它。它可以毫无问题地接收电子邮件,这表明入站服务器运行正常。

此时它也不会在 mail.err 文件中生成任何错误。

以下是 mail.log 文件的摘录。

Sep 15 01:34:12 lamp-512mb-nyc3-01 postfix/qmgr[9953]: F02FF1F8F98: from=
<[email protected]>, size=2312, nrcpt=1 (queue active)
Sep 15 01:34:12 lamp-512mb-nyc3-01 postfix/smtp[9963]: connect to gmail-
smtp-in.l.google.com[2607:f8b0:400d:c01::1a]:25: Network is unreachable
Sep 15 01:34:42 lamp-512mb-nyc3-01 postfix/smtp[9963]: connect to gmail-
smtp-in.l.google.com[173.194.68.26]:25: Connection timed out
Sep 15 01:34:42 lamp-512mb-nyc3-01 postfix/smtp[9963]: connect to 
alt1.gmail-smtp-in.l.google.com[2800:3f0:4003:c01::1b]:25: Network is 
unreachable
Sep 15 01:34:42 lamp-512mb-nyc3-01 postfix/smtp[9989]: connect to 
aspmx.l.google.com[173.194.207.27]:25: Connection timed out
Sep 15 01:34:42 lamp-512mb-nyc3-01 postfix/smtp[9989]: connect to 
aspmx.l.google.com[2607:f8b0:400d:c0c::1a]:25: Network is unreachable
Sep 15 01:34:42 lamp-512mb-nyc3-01 postfix/smtp[9989]: connect to 
alt1.aspmx.l.google.com[2800:3f0:4003:c01::1a]:25: Network is unreachable

知道我为什么会收到这些错误吗?

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 = 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_recipient_restrictions = permit_sasl_authenticated permit_mynetworks reject_unauth_destination
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
smtpd_sasl_auth_enable = yes
smtpd_sasl_path = private/auth
smtpd_sasl_type = dovecot
smtpd_tls_auth_only = yes
smtpd_tls_cert_file = /etc/letsencrypt/live/Example.com/fullchain.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

答案1

这看起来好像端口 25 上的传出连接被防火墙阻止了。运行telnet gmail- smtp-in.l.google.com 25以手动建立与某个 SMTP 服务器的连接(并尝试其他目标主机,以防只有 google 成为目标)。

如果连接正常,您应该收到类似如下的输出:

Trying 2a00:1450:400c:c06::1b...
Connected to gmail-smtp-in.l.google.com.
Escape character is '^]'.
220 mx.google.com ESMTP q18si2099858wre.148 - gsmtp

如果您还收到连接超时telnet,请检查系统中是否存在本地防火墙,并联系您的网络管理员/操作员,以在其防火墙中打开端口 25 上的传出连接。如果您在某些商用路由器后面操作服务器:有些路由器还会阻止端口 25 上的连接尝试,在这种情况下请查阅路由器配置或手册(但请注意,大多数收件人站点会阻止来自非静态 IP 地址的邮件以对抗垃圾邮件,在这种情况下请使用智能主机发送邮件)。

相关内容