通过 Postfix 测试发送时,从 G Suite 中继地址解析 IPv6 导致出现“凭据无效”

通过 Postfix 测试发送时,从 G Suite 中继地址解析 IPv6 导致出现“凭据无效”

我遇到了一个有线问题,显然是 Gmail 中继服务随机解析为 IPv4/v6,导致身份验证无法通过。

我使用了 DigitalOcean Ubuntu 18.10 + Postfix + G Suite 帐户 + Let's Encrypt,所有配置均按照以下说明进行。

通过 SSH 终端测试时(在本地服务器上发送邮件)

sendmail [email protected]
From: [email protected]
Subject: Test mail
This is a test email
.

我随机得到了两个不同的结果:

失败:

postfix/pickup[21093]: E16871F9559: uid=1000 from=<eric>
postfix/cleanup[25243]: E16871F9559: message-id=<[email protected]>
postfix/qmgr[21094]: E16871F9559: from=<[email protected]>, size=299, nrcpt=1 (queue active)
postfix/smtp[25246]: E16871F9559: to=<[email protected]>, relay=smtp-relay.gmail.com[2a00:1450:400c:c0a::1c]:587, delay=12, delays=12/0.01/0.3/0.02, dsn=5.7.1, status=bounced (host smtp-relay.gmail.com[2a00:1450:400c:c0a::1c] said: 550-5.7.1 Invalid credentials for relay [2a03:b0c0:1:d0::59a:1]. The IP address 550-5.7.1 you've registered in your G Suite SMTP Relay service doesn't match 550-5.7.1 domain of the account this email is being sent from. If you are 550-5.7.1 trying to relay mail from a domain that isn't registered under your G 550-5.7.1 Suite account or has empty envelope-from, you must configure your 550-5.7.1 mail server either to use SMTP AUTH to identify the sending domain or 550-5.7.1 to present one of your domain names in the HELO or EHLO command. For 550-5.7.1 more information, please visit 550 5.7.1  https://support.google.com/a/answer/6140680#invalidcred c2sm93605wrr.48 - gsmtp (in reply to MAIL FROM command))
postfix/smtp[25246]: E16871F9559: lost connection with smtp-relay.gmail.com[2a00:1450:400c:c0a::1c] while sending RCPT TO
postfix/cleanup[25243]: 46B1F1F955A: message-id=<[email protected]>
postfix/qmgr[21094]: 46B1F1F955A: from=<>, size=3748, nrcpt=1 (queue active)
postfix/trivial-rewrite[25245]: warning: do not list domain mydomain.com in BOTH mydestination and virtual_alias_domains
postfix/bounce[25248]: E16871F9559: sender non-delivery notification: 46B1F1F955A
postfix/qmgr[21094]: E16871F9559: removed
postfix/local[25250]: warning: database /etc/aliases.db is older than source file /etc/aliases
postfix/local[25250]: 46B1F1F955A: to=<[email protected]>, orig_to=<[email protected]>, relay=local, delay=0.02, delays=0/0.02/0/0, dsn=2.0.0, status=sent (delivered to file: /dev/null)
postfix/qmgr[21094]: 46B1F1F955A: removed

成功并且我收到了邮件

postfix/pickup[21093]: 10C7A1F9559: uid=1000 from=<eric>
postfix/cleanup[25243]: 10C7A1F9559: message-id=<[email protected]>
postfix/qmgr[21094]: 10C7A1F9559: from=<[email protected]>, size=299, nrcpt=1 (queue active)
postfix/smtp[25246]: 10C7A1F9559: to=<[email protected]>, relay=smtp-relay.gmail.com[64.233.167.28]:587, delay=24, delays=23/0/0.44/0.06, dsn=2.0.0, status=sent (250 2.0.0 OK  1552768189 e2sm92429wrr.91 - gsmtp)
postfix/qmgr[21094]: 10C7A1F9559: removed

通过查看差异,我发现如果中继服务器解析为 IPv6,它将无法通过凭证检查。有人能找出问题所在吗?

临时解决方法:我必须将 Gmail 中继服务设置为:仅接受来自指定 IP 地址的邮件:否

编辑:通过在 G Suite Gmail 中继设置下禁用“仅接受来自指定 IP 地址的邮件”,问题已得到解决(解决方法)。我确实将我的主机服务器 IP 添加为唯一允许接受电子邮件的 IP:

G Suite Gmail 中继设置

相关内容