![Postfix 无法发送或接收电子邮件](https://linux22.com/image/727534/Postfix%20%E6%97%A0%E6%B3%95%E5%8F%91%E9%80%81%E6%88%96%E6%8E%A5%E6%94%B6%E7%94%B5%E5%AD%90%E9%82%AE%E4%BB%B6.png)
我已经在我的服务器上安装了 PostFix,它也与 dovecot 一起运行。我的服务器运行的是 Ubuntu 16.04。我无法从也在我服务器上运行的 squirrelmail 发送或接收电子邮件,它甚至无法在本地发送或接收电子邮件。
输出postconf -n
如下:
root@thatmadhacker:/etc# postconf -n
alias_database = hash:/etc/aliases
alias_maps = hash:/etc/aliases
append_dot_mydomain = no
biff = no
canonical_maps = hash:/etc/postfix/canonical
default_destination_concurrency_limit = 5
disable_vrfy_command = yes
dovecot_destination_recipient_limit = 1
home_mailbox = Maildir/
inet_interfaces = all
inet_protocols = ipv4
mailbox_size_limit = 0
message_size_limit = 104857600
mydestination = $myhostname, thatmadhacker.org, localhost
myhostname = thatmadhacker.org
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
myorigin = $myhostname
readme_directory = no
recipient_delimiter = +
relay_destination_concurrency_limit = 1
relayhost =
smtp_tls_note_starttls_offer = yes
smtp_tls_security_level = may
smtp_tls_session_cache_database = btree:${data_directory}/smtp_scache
smtpd_banner = $myhostname ESMTP smtpd_helo_required = yes reject_non_fqdn_helo_hostname, reject_invalid_helo_hostname, reject_unknown_helo_hostname, permit reject_unknown_sender_domain, reject_unknown_recipient_domain, reject_unauth_pipelining, permit_mynetworks, permit_sasl_authenticated, reject_unauth_destination, reject_invalid_hostname, reject_non_fqdn_sender reject_sender_login_mismatch
smtpd_sender_login_maps = $virtual_mailbox_maps
smtpd_tls_CAfile = /etc/ssl/certs/ca-certificates.crt
smtpd_tls_ask_ccert = yes
smtpd_tls_cert_file = /etc/letsencrypt/live/thatmadhacker.org/cert.pem
smtpd_tls_key_file = /etc/letsencrypt/live/thatmadhacker.org/privkey.pem
smtpd_tls_session_cache_database = btree:${data_directory}/smtpd_scache
smtpd_use_tls = yes
unknown_address_reject_code = 550
unknown_client_reject_code = 550
unknown_hostname_reject_code = 550
virtual_alias_maps = hash:/etc/postfix/virtual
virtual_mailbox_domains = hash:/etc/postfix/virtual-mailbox-domains
virtual_mailbox_maps = hash:/etc/postfix/virtual-mailbox-users
virtual_transport = dovecot
内容也在/var/log/mail.log
这里:
还请注意,在一些日志中说[电子邮件保护],我忘了在别名文件中更改它,在我复制日志后它被更改了,但同样的问题仍然存在
Sep 23 19:11:53 thatmadhacker postfix/smtp[1877]: connect to alt1.gmail-smtp-in.l.google.com[173.194.66.26]:25: Connection timed out
Sep 23 19:11:53 thatmadhacker postfix/smtp[1878]: connect to alt1.gmail-smtp-in.l.google.com[173.194.66.26]:25: Connection timed out
Sep 23 19:12:23 thatmadhacker postfix/smtp[1877]: connect to alt2.gmail-smtp-in.l.google.com[74.125.31.26]:25: Connection timed out
Sep 23 19:12:23 thatmadhacker postfix/smtp[1878]: connect to alt2.gmail-smtp-in.l.google.com[74.125.31.26]:25: Connection timed out
Sep 23 19:12:53 thatmadhacker postfix/smtp[1877]: connect to alt3.gmail-smtp-in.l.google.com[64.233.186.26]:25: Connection timed out
Sep 23 19:12:53 thatmadhacker postfix/smtp[1878]: connect to alt3.gmail-smtp-in.l.google.com[64.233.186.26]:25: Connection timed out
Sep 23 19:13:23 thatmadhacker postfix/smtp[1877]: connect to alt4.gmail-smtp-in.l.google.com[74.125.193.26]:25: Connection timed out
Sep 23 19:13:23 thatmadhacker postfix/smtp[1878]: connect to alt4.gmail-smtp-in.l.google.com[74.125.193.26]:25: Connection timed out
Sep 23 19:13:24 thatmadhacker postfix/smtp[1877]: 092A3811F6: to=<[email protected]>, relay=none, delay=3651, delays=3501/0.02/150/0, dsn=4.4.1, status=deferred (connect to alt4.gmail-smtp-in.l.google.com[74.125.193.26]:25: Connection timed out)
Sep 23 19:13:24 thatmadhacker postfix/smtp[1878]: 0DFD7811ED: to=<[email protected]>, relay=none, delay=4328, delays=4178/0.02/150/0, dsn=4.4.1, status=deferred (connect to alt4.gmail-smtp-in.l.google.com[74.125.193.26]:25: Connection timed out)
Sep 23 19:20:53 thatmadhacker postfix/qmgr[31700]: A14CE811EA: from=<[email protected]>, size=749, nrcpt=1 (queue active)
Sep 23 19:21:23 thatmadhacker postfix/smtp[3001]: connect to gmail-smtp-in.l.google.com[173.194.197.26]:25: Connection timed out
Sep 23 19:21:53 thatmadhacker postfix/smtp[3001]: connect to alt1.gmail-smtp-in.l.google.com[173.194.66.27]:25: Connection timed out
Sep 23 19:22:23 thatmadhacker postfix/smtp[3001]: connect to alt2.gmail-smtp-in.l.google.com[172.217.193.26]:25: Connection timed out
Sep 23 19:22:53 thatmadhacker postfix/smtp[3001]: connect to alt3.gmail-smtp-in.l.google.com[64.233.186.27]:25: Connection timed out
Sep 23 19:23:23 thatmadhacker postfix/smtp[3001]: connect to alt4.gmail-smtp-in.l.google.com[74.125.193.27]:25: Connection timed out
Sep 23 19:23:23 thatmadhacker postfix/smtp[3001]: A14CE811EA: to=<[email protected]>, relay=none, delay=8062, delays=7912/0.02/150/0, dsn=4.4.1, status=deferred (connect to alt4.gmail-smtp-in.l.google.com[74.125.193.27]:25: Connection timed out)
Sep 23 19:25:53 thatmadhacker postfix/qmgr[31700]: 82EB4811F7: from=<[email protected]>, size=757, nrcpt=1 (queue active)
Sep 23 19:25:53 thatmadhacker postfix/qmgr[31700]: 81E8D811F3: from=<[email protected]>, size=899, nrcpt=1 (queue active)
Sep 23 19:26:23 thatmadhacker postfix/smtp[3392]: connect to nullmx.domainmanager.com[45.63.18.247]:25: Connection timed out
Sep 23 19:26:23 thatmadhacker postfix/smtp[3391]: connect to gmail-smtp-in.l.google.com[64.233.183.27]:25: Connection timed out
Sep 23 19:26:23 thatmadhacker postfix/smtp[3392]: 81E8D811F3: to=<[email protected]>, orig_to=<[email protected]>, relay=none, delay=6266, delays=6236/0.03/30/0, dsn=4.4.1, status=deferred (connect to nullmx.domainmanager.com[45.63.18.247]:25: Connection timed out)
Sep 23 19:26:53 thatmadhacker postfix/smtp[3391]: connect to alt1.gmail-smtp-in.l.google.com[173.194.66.26]:25: Connection timed out
Sep 23 19:27:23 thatmadhacker postfix/smtp[3391]: connect to alt2.gmail-smtp-in.l.google.com[172.217.193.26]:25: Connection timed out
Sep 23 19:27:53 thatmadhacker postfix/smtp[3391]: connect to alt3.gmail-smtp-in.l.google.com[64.233.186.27]:25: Connection timed out
Sep 23 19:28:23 thatmadhacker postfix/smtp[3391]: connect to alt4.gmail-smtp-in.l.google.com[74.125.193.27]:25: Connection timed out
Sep 23 19:28:23 thatmadhacker postfix/smtp[3391]: 82EB4811F7: to=<[email protected]>, relay=none, delay=3401, delays=3251/0.02/150/0, dsn=4.4.1, status=deferred (connect to alt4.gmail-smtp-in.l.google.com[74.125.193.27]:25: Connection timed out)
Sep 23 19:50:53 thatmadhacker postfix/qmgr[31700]: 8BC4A811EC: from=<[email protected]>, size=1064, nrcpt=1 (queue active)
Sep 23 19:50:53 thatmadhacker postfix/qmgr[31700]: 96302811EB: from=<[email protected]>, size=1068, nrcpt=1 (queue active)
Sep 23 19:51:24 thatmadhacker postfix/smtp[5374]: connect to nullmx.domainmanager.com[45.63.18.247]:25: Connection timed out
Sep 23 19:51:24 thatmadhacker postfix/smtp[5375]: connect to nullmx.domainmanager.com[45.63.18.247]:25: Connection timed out
Sep 23 19:51:24 thatmadhacker postfix/smtp[5374]: 8BC4A811EC: to=<[email protected]>, orig_to=<postmaster>, relay=none, delay=10049, delays=10019/0.02/30/0, dsn=4.4.1, status=deferred (connect to nullmx.domainmanager.com[45.63.18.247]:25: Connection timed out)
Sep 23 19:51:24 thatmadhacker postfix/smtp[5375]: 96302811EB: to=<[email protected]>, orig_to=<postmaster>, relay=none, delay=10077, delays=10047/0.02/30/0, dsn=4.4.1, status=deferred (connect to nullmx.domainmanager.com[45.63.18.247]:25: Connection timed out)
Sep 23 19:55:53 thatmadhacker postfix/qmgr[31700]: BC6D1811EE: from=<[email protected]>, size=907, nrcpt=1 (queue active)
Sep 23 19:55:53 thatmadhacker postfix/qmgr[31700]: D92C3811F2: from=<[email protected]>, size=898, nrcpt=1 (queue active)
Sep 23 19:56:23 thatmadhacker postfix/smtp[5788]: connect to nullmx.domainmanager.com[45.63.18.247]:25: Connection timed out
Sep 23 19:56:23 thatmadhacker postfix/smtp[5789]: connect to nullmx.domainmanager.com[45.63.18.247]:25: Connection timed out
Sep 23 19:56:23 thatmadhacker postfix/smtp[5788]: BC6D1811EE: to=<[email protected]>, orig_to=<[email protected]>, relay=none, delay=9757, delays=9726/0.02/30/0, dsn=4.4.1, status=deferred (connect to nullmx.domainmanager.com[45.63.18.247]:25: Connection timed out)
Sep 23 19:56:23 thatmadhacker postfix/smtp[5789]: D92C3811F2: to=<[email protected]>, orig_to=<[email protected]>, relay=none, delay=8438, delays=8408/0.03/30/0, dsn=4.4.1, status=deferred (connect to nullmx.domainmanager.com[45.63.18.247]:25: Connection timed out)
Sep 23 20:05:53 thatmadhacker postfix/qmgr[31700]: 8B9FE811F0: from=<[email protected]>, size=899, nrcpt=1 (queue active)
Sep 23 20:05:53 thatmadhacker postfix/qmgr[31700]: AB967811EF: from=<[email protected]>, size=899, nrcpt=1 (queue active)
Sep 23 20:06:23 thatmadhacker postfix/smtp[6557]: connect to nullmx.domainmanager.com[45.63.18.247]:25: Connection timed out
Sep 23 20:06:23 thatmadhacker postfix/smtp[6556]: connect to nullmx.domainmanager.com[45.63.18.247]:25: Connection timed out
Sep 23 20:06:23 thatmadhacker postfix/smtp[6557]: AB967811EF: to=<[email protected]>, orig_to=<[email protected]>, relay=none, delay=9554, delays=9524/0.03/30/0, dsn=4.4.1, status=deferred (connect to nullmx.domainmanager.com[45.63.18.247]:25: Connection timed out)
Sep 23 20:06:23 thatmadhacker postfix/smtp[6556]: 8B9FE811F0: to=<[email protected]>, orig_to=<[email protected]>, relay=none, delay=9552, delays=9522/0.03/30/0, dsn=4.4.1, status=deferred (connect to nullmx.domainmanager.com[45.63.18.247]:25: Connection timed out)
Sep 23 20:15:53 thatmadhacker postfix/qmgr[31700]: 388D4811F1: from=<[email protected]>, size=899, nrcpt=1 (queue active)
Sep 23 20:15:53 thatmadhacker postfix/qmgr[31700]: 092A3811F6: from=<[email protected]>, size=759, nrcpt=1 (queue active)
Sep 23 20:15:53 thatmadhacker postfix/qmgr[31700]: 7EAA1811E9: from=<[email protected]>, size=730, nrcpt=1 (queue active)
Sep 23 20:16:23 thatmadhacker postfix/smtp[7376]: connect to nullmx.domainmanager.com[45.63.18.247]:25: Connection timed out
Sep 23 20:16:23 thatmadhacker postfix/smtp[7377]: connect to gmail-smtp-in.l.google.com[64.233.183.26]:25: Connection timed out
Sep 23 20:16:23 thatmadhacker postfix/smtp[7378]: connect to gmail-smtp-in.l.google.com[64.233.183.26]:25: Connection timed out
Sep 23 20:16:23 thatmadhacker postfix/smtp[7376]: 388D4811F1: to=<[email protected]>, orig_to=<[email protected]>, relay=none, delay=9951, delays=9921/0.02/30/0, dsn=4.4.1, status=deferred (connect to nullmx.domainmanager.com[45.63.18.247]:25: Connection timed out)
编辑:我还检查了一下,我的服务器可以通过端口 25 进行通信。这也是当我从我的服务器手动连接到 Gmail 邮件服务器时发生的情况
telnet alt4.gmail-smtp-in.l.google.com 25
Trying 2a00:1450:400b:c01::1b...
Connected to alt4.gmail-smtp-in.l.google.com.
Escape character is '^]'.
220 mx.google.com ESMTP k14-v6si14677187wmd.98 - gsmtp
答案1
该错误recipient-MX-hostname[ip-address]:25: Connection timed out
似乎表明传出的 SMTP 流量被防火墙阻止。
检查您自己的防火墙和/或查阅您的互联网提供商的文档,因为许多(消费者)ISP 不允许传出邮件流量,阻止 SMTP 端口 25 并要求使用他们的邮件中继。