Gmail 中继阻止我向本地机器发送 cron 邮件

Gmail 中继阻止我向本地机器发送 cron 邮件

我在 Ubuntu 18.04 网络服务器上配置了 postfix,以使用我的 gmail 帐户作为 smtp 中继来发送电子邮件。

我的 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 = db_server
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
mydestination = localhost.dbserver, , localhost
relayhost = [smtp.gmail.com]:587
mynetworks = 127.0.0.0/8 [::ffff:127.0.0.0]/104 [::1]/128
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all

# Enables SASL authentication for postfix
smtp_sasl_auth_enable = yes
# Disallow methods that allow anonymous authentication
smtp_sasl_security_options = noanonymous
# Location of sasl_passwd we saved
smtp_sasl_password_maps = hash:/etc/postfix/sasl/sasl_passwd
# Enable STARTTLS encryption for SMTP
smtp_tls_security_level = encrypt
# Location of CA certificates for TLS
smtp_tls_CAfile = /etc/ssl/certs/ca-certificates.crt

现在的问题是,crontab 无法再向我的本地计算机和邮箱发送电子邮件通知。
如果我查看我的系统日志文件,我会得到以下输出:

Feb 27 13:38:01 db_server CRON[9149]: (ubuntu) CMD (/usr/bin/python3 ~/test.py)  
Feb 27 13:38:01 db_server postfix/pickup[8469]: CB88A3F58B: uid=1000 from=<ubuntu>  
Feb 27 13:38:01 db_server postfix/cleanup[9024]: CB88A3F58B: message-id=<20200227133801.CB88A3F58B@db_server>  
Feb 27 13:38:01 db_server postfix/qmgr[2672]: CB88A3F58B: from=<ubuntu@db_server>, size=660, nrcpt=1 (queue active)  
Feb 27 13:38:01 db_server postfix/smtp[9026]: connect to smtp.gmail.com[2a00:1450:400c:c00::6d]:587: Network is unreachable  
Feb 27 13:38:02 db_server postfix/smtp[9026]: CB88A3F58B: to=<ubuntu@db_server>, orig_to=<ubuntu>, relay=smtp.gmail.com[173.194.76.108]:587, delay=0.3, delays=0.02/0/0.26/0.02, dsn=5.1.3, status=bounced (host s$Feb 27 13:38:02 db_server postfix/cleanup[9024]: 211CC3FC5E: message-id=<20200227133802.211CC3FC5E@db_server>  
Feb 27 13:38:02 db_server postfix/qmgr[2672]: 211CC3FC5E: from=<>, size=2777, nrcpt=1 (queue active)  
Feb 27 13:38:02 db_server postfix/bounce[9027]: CB88A3F58B: sender non-delivery notification: 211CC3FC5E  
Feb 27 13:38:02 db_server postfix/qmgr[2672]: CB88A3F58B: removed  
Feb 27 13:38:02 db_server postfix/smtp[9026]: connect to smtp.gmail.com[2a00:1450:400c:c00::6d]:587: Network is unreachable  
Feb 27 13:38:02 db_server postfix/smtp[9026]: 211CC3FC5E: to=<ubuntu@db_server>, relay=smtp.gmail.com[173.194.76.108]:587, delay=0.27, delays=0.01/0/0.24/0.02, dsn=5.1.3, status=bounced (host smtp.gmail.com[173$Feb 27 13:38:02 db_server postfix/qmgr[2672]: 211CC3FC5E: removed

据我所知(不算太多),我无法发送到 ubuntu@db_server,因为它不是有效的电子邮件地址。将这些通知发送到我的一个电子邮件地址没有任何问题。

是否仍然可以将这些 cron 通知发送到我的本地邮箱,同时保留中继配置?

相关内容