Я столкнулся с проблемой проводной связи, очевидно, что служба ретрансляции Gmail решается как IPv4 / v6 случайным образом, что приводит к тому, что аутентификация не проходит.
Я использовал DigitalOcean Ubuntu 18.10 + Postfix + учетную запись G Suite + Let's Encrypt, все настроено, следуя инструкциям ниже.
При тестировании через SSH-терминал (sendmail на локальном сервере)
sendmail my.test.account@gmail.com
From: support@mydomain.com
Subject: Test mail
This is a test email
.
Случайным образом я получил два разных результата:
Потерпеть поражение:
postfix/pickup[21093]: E16871F9559: uid=1000 from=<eric>
postfix/cleanup[25243]: E16871F9559: message-id=<20190316202842.E16871F9559@masternode.mydomain.com>
postfix/qmgr[21094]: E16871F9559: from=<eric@mydomain.com>, size=299, nrcpt=1 (queue active)
postfix/smtp[25246]: E16871F9559: to=<my.test.account@gmail.com>, 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=<20190316202843.46B1F1F955A@masternode.mydomain.com>
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=<nobody@mydomain.com>, orig_to=<eric@mydomain.com>, 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=<20190316202949.10C7A1F9559@masternode.mydomain.com>
postfix/qmgr[21094]: 10C7A1F9559: from=<eric@mydomain.com>, size=299, nrcpt=1 (queue active)
postfix/smtp[25246]: 10C7A1F9559: to=<my.test.account@gmail.com>, 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-адресов: Нет
Изменить: проблема была решена (временное решение) путем отключения параметра «Принимать почту только с указанных IP-адресов» в настройках ретрансляции Gmail G Suite. Я добавил свой IP-адрес хост-сервера как единственный IP-адрес, которому разрешено принимать электронные письма: