我有Ubuntu 18.04.2LTS 安装在VMware,在 Windows 内部。
使用终端,我尝试使用以下命令发送测试电子邮件:
echo "Test Email message body" | mail -s "Email test subject" [email protected]
然而/var/log/mail.log
节目:
connect to gmail-smtp-in.l.google.com[64.233.190.27]:25: Connection refused
和
connect to gmail-smtp-in.l.google.com[2800:3f0:4003:c01::1b]:25: Network is unreachable
以下是完整日志:
May 13 16:50:59 ubuntu postfix/postfix-script[1250]: starting the
Postfix mail system May 13 16:50:59 ubuntu postfix/master[1257]:
daemon started -- version 3.3.0, configuration /etc/postfix May 13
16:50:59 ubuntu postfix/qmgr[1260]: B69EE868E2: from=<root@ubuntu>,
size=363, nrcpt=1 (queue active) May 13 16:50:59 ubuntu
postfix/qmgr[1260]: C56A4857C2: from=<root@ubuntu>, size=364, nrcpt=1
(queue active) May 13 16:51:20 ubuntu postfix/smtp[1263]: connect to
gmail-smtp-in.l.google.com[64.233.190.27]:25: Connection refused May
13 16:51:20 ubuntu postfix/smtp[1264]: connect to
gmail-smtp-in.l.google.com[64.233.190.27]:25: Connection refused May
13 16:51:20 ubuntu postfix/smtp[1264]: connect to
gmail-smtp-in.l.google.com[2800:3f0:4003:c01::1b]:25: Network is
unreachable May 13 16:51:20 ubuntu postfix/smtp[1263]: connect to
gmail-smtp-in.l.google.com[2800:3f0:4003:c01::1b]:25: Network is
unreachable May 13 16:51:34 ubuntu postfix/pickup[1259]: 9A493868DB:
uid=0 from=<root@ubuntu> May 13 16:51:34 ubuntu postfix/cleanup[1856]:
9A493868DB: message-id=<[email protected]>
May 13 16:51:34 ubuntu postfix/qmgr[1260]: 9A493868DB:
from=<root@ubuntu>, size=362, nrcpt=1 (queue active) May 13 16:51:35
ubuntu postfix/smtp[1857]: connect to
gmail-smtp-in.l.google.com[2800:3f0:4003:c01::1a]:25: Network is
unreachable May 13 16:51:42 ubuntu postfix/smtp[1263]: connect to
alt1.gmail-smtp-in.l.google.com[66.102.1.26]:25: Connection refused
May 13 16:51:42 ubuntu postfix/smtp[1263]: connect to
alt1.gmail-smtp-in.l.google.com[2a00:1450:400c:c06::1a]:25: Network is
unreachable May 13 16:51:42 ubuntu postfix/smtp[1264]: connect to
alt1.gmail-smtp-in.l.google.com[66.102.1.26]:25: Connection refused
May 13 16:51:42 ubuntu postfix/smtp[1264]: connect to
alt1.gmail-smtp-in.l.google.com[2a00:1450:400c:c06::1a]:25: Network is
unreachable May 13 16:51:56 ubuntu postfix/smtp[1857]: connect to
gmail-smtp-in.l.google.com[64.233.190.26]:25: Connection refused May
13 16:51:56 ubuntu postfix/smtp[1857]: connect to
alt1.gmail-smtp-in.l.google.com[2a00:1450:400c:c06::1a]:25: Network is
unreachable May 13 16:52:03 ubuntu postfix/smtp[1264]: connect to
alt2.gmail-smtp-in.l.google.com[173.194.79.27]:25: Connection refused
May 13 16:52:03 ubuntu postfix/smtp[1263]: connect to
alt2.gmail-smtp-in.l.google.com[173.194.79.27]:25: Connection refused
May 13 16:52:03 ubuntu postfix/smtp[1263]: B69EE868E2:
to=<[email protected]>, relay=none, delay=95, delays=31/0.03/64/0,
dsn=4.4.1, status=deferred (connect to
alt2.gmail-smtp-in.l.google.com[173.194.79.27]:25: Connection refused)
May 13 16:52:03 ubuntu postfix/smtp[1264]: C56A4857C2:
to=<[email protected]>, relay=none, delay=448, delays=384/0.02/64/0,
dsn=4.4.1, status=deferred (connect to
alt2.gmail-smtp-in.l.google.com[173.194.79.27]:25: Connection refused)
May 13 16:52:17 ubuntu postfix/smtp[1857]: connect to
alt1.gmail-smtp-in.l.google.com[66.102.1.27]:25: Connection refused
May 13 16:52:17 ubuntu postfix/smtp[1857]: connect to
alt2.gmail-smtp-in.l.google.com[2a00:1450:4013:c05::1a]:25: Network is
unreachable May 13 16:52:17 ubuntu postfix/smtp[1857]: 9A493868DB:
to=<[email protected]>, relay=none, delay=43, delays=0.03/0.01/43/0,
dsn=4.4.1, status=deferred (connect to
alt2.gmail-smtp-in.l.google.com[2a00:1450:4013:c05::1a]:25: Network is
unreachable) May 13 16:55:59 ubuntu postfix/qmgr[1260]: EA29D868DD:
from=<root@ubuntu>, size=363, nrcpt=1 (queue active) May 13 16:55:59
ubuntu postfix/qmgr[1260]: 768FA868E1: from=<root@ubuntu>, size=363,
nrcpt=1 (queue active) May 13 16:55:59 ubuntu postfix/error[2044]:
768FA868E1: to=<[email protected]>, relay=none, delay=370,
delays=370/0.01/0/0.01, dsn=4.4.1, status=deferred (delivery
temporarily suspended: connect to
alt2.gmail-smtp-in.l.google.com[2a00:1450:4013:c05::1a]:25: Network is
unreachable) May 13 16:55:59 ubuntu postfix/error[2043]: EA29D868DD:
to=<[email protected]>, relay=none, delay=520,
delays=520/0.03/0/0.02, dsn=4.4.1, status=deferred (delivery
temporarily suspended: connect to
alt2.gmail-smtp-in.l.google.com[2a00:1450:4013:c05::1a]:25: Network is
unreachable)
怎么了?
编辑
这里的内容/etc/postfix/main.cf
:
# See /usr/share/postfix/main.cf.dist for a commented, more complete version
# 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
# See http://www.postfix.org/COMPATIBILITY_README.html -- default to 2 on
# fresh installs.
compatibility_level = 2
# 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.
smtpd_relay_restrictions = permit_mynetworks permit_sasl_authenticated defer_unauth_destination
myhostname = rogeriodec.com.br
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination = $myhostname, ubuntu, localhost.localdomain, , localhost
relayhost =
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = loopback-only
inet_protocols = all