为什么我无法发送邮件到远程邮箱?

lud*_*egu 7 smtp email postfix

我已经在我的 CentOS 机器上安装了 Postfix。我可以很好地使用 将邮件发送到本地帐户mutt,但是当我尝试将邮件发送到 myactualmail@gmail.com 之类的远程邮件时,我不明白为什么我无法接收任何内容。这是我的main.cf

queue_directory = /var/spool/postfix
command_directory = /usr/sbin
daemon_directory = /usr/libexec/postfix
data_directory = /var/lib/postfix
mail_owner = postfix
myhostname = server.example.com
mydomain = example.com
myorigin = $mydomain
inet_interfaces = all
inet_protocols = all
mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
unknown_local_recipient_reject_code = 550
mynetworks = 192.168.200.0/24, 127.0.0.0/8
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
debug_peer_level = 2
debugger_command =
     PATH=/bin:/usr/bin:/usr/local/bin:/usr/X11R6/bin
     ddd $daemon_directory/$process_name $process_id & sleep 5


sendmail_path = /usr/sbin/sendmail.postfix
newaliases_path = /usr/bin/newaliases.postfix
mailq_path = /usr/bin/mailq.postfix
setgid_group = postdrop
html_directory = no
manpage_directory = /usr/share/man
sample_directory = /usr/share/doc/postfix-2.6.6/samples
readme_directory = /usr/share/doc/postfix-2.6.6/README_FILES
Run Code Online (Sandbox Code Playgroud)

在邮件日志中,我找到了这些:

Jan 22 14:33:15 server postfix/qmgr[5025]: 316FEBF65E: from=<diego@example.com>, size=430, nrcpt=1 (queue active)
Jan 22 14:33:15 server postfix/smtp[5276]: connect to gmail-smtp-in.l.google.com[2a00:1450:400c:c05::1b]:25: Network is unreachable
Jan 22 14:33:15 server postfix/smtp[5276]: connect to gmail-smtp-in.l.google.com[173.194.66.26]:25: Connection refused
Jan 22 14:33:15 server postfix/smtp[5276]: connect to alt1.gmail-smtp-in.l.google.com[2a00:1450:400c:c05::1a]:25: Network is unreachable
Jan 22 14:33:15 server postfix/smtp[5276]: connect to alt1.gmail-smtp-in.l.google.com[173.194.70.26]:25: Connection refused
Jan 22 14:33:15 server postfix/smtp[5276]: connect to alt2.gmail-smtp-in.l.google.com[2a00:1450:400c:c05::1b]:25: Network is unreachable
Jan 22 14:33:15 server postfix/smtp[5276]: 316FEBF65E: to=<myactualmail@gmail.com>, relay=none, delay=2662, delays=2661/0.04/0.08/0, dsn=4.4.1, status=deferred (connect to alt2.gmail-smtp-in.l.google.com[2a00:1450:400c:c05::1b]:25: Network is unreachable)
Run Code Online (Sandbox Code Playgroud)

但是我可以很好地ping主机:

ping gmail-smtp-in.l.google.com
PING gmail-smtp-in.l.google.com (173.194.66.26) 56(84) bytes of data.
64 bytes from we-in-f26.1e100.net (173.194.66.26): icmp_seq=1 ttl=128 time=29.2 ms
64 bytes from we-in-f26.1e100.net (173.194.66.26): icmp_seq=2 ttl=128 time=29.6 ms
64 bytes from we-in-f26.1e100.net (173.194.66.26): icmp_seq=3 ttl=128 time=31.0 ms
Run Code Online (Sandbox Code Playgroud)

Tim*_*imo 8

如果出现 SMTP 问题且配置似乎没问题,首先要做的是您实际上可以访问 SMTP 服务器。

用:

telnet gmail-smtp-in.l.google.com 25
Run Code Online (Sandbox Code Playgroud)

你应该看到:

Trying 173.194.69.27...
Connected to gmail-smtp-in.l.google.com.
Escape character is '^]'.
220 mx.google.com ESMTP lv5si9142984bkb.114 - gsmtp
Run Code Online (Sandbox Code Playgroud)

(在那之后键入 QUITEnter退出)如果这没有显示您的防火墙(或者更有可能是您的提供商之一)可能会阻止您。如果可能,请从另一个位置尝试此操作,以仔细检查机器是否正在响应(在您的情况下gmail-smtp-in.l.google.com正在响应)。

如果提供商是原因,您可能需要使用其 STMP 服务器(他们试图以这种方式防止垃圾邮件从您的系统中流出)。