我尝试使用 PHP 脚本通过 sendmail (Debian 8) 发送邮件。它确实有效,但只有 gmail 不起作用。
从 root 发送邮件,我收到此消息
[email protected]... Connecting to gmail-smtp-in.l.google.com. via esmtp...
220 mx.google.com ESMTP ej8si17844651wjd.175 - gsmtp
>>> EHLO nxxxxx.eu
250-mx.google.com at your service, [2001:41d0:e:4c8::1]
250-SIZE 35882577
250-8BITMIME
250-STARTTLS
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-CHUNKING
250 SMTPUTF8
>>> STARTTLS
220 2.0.0 Ready to start TLS
>>> EHLO xxxxx.eu
250-mx.google.com at your service, [2001:41d0:e:4c8::1]
250-SIZE 35882577
250-8BITMIME
250-ENHANCEDSTATUSCODES
250-PIPELINING
250-CHUNKING
250 SMTPUTF8
>>> MAIL From:<[email protected]> SIZE=20
250 2.1.0 OK ej8si17844651wjd.175 - gsmtp
>>> RCPT To:<[email protected]>
>>> DATA
250 2.1.5 OK ej8si17844651wjd.175 - gsmtp
354 Go ahead ej8si17844651wjd.175 - gsmtp
>>> .
**550-5.7.1 [2001:41d0:e:4c8::1] Our system has detected that this message does
550-5.7.1 not meet IPv6 sending guidelines regarding PTR records and
550-5.7.1 authentication. Please review
550-5.7.1 https://support.google.com/mail/?p=ipv6_authentication_error for more**
550 5.7.1 information. ej8si17844651wjd.175 - gsmtp
/root/dead.letter... Saved message in /root/dead.letter
Closing connection to gmail-smtp-in.l.google.com.
>>> QUIT
Feb 12 09:49:57 ns380959 sendmail[9314]: u1C8nv7O009314: from=www-data, size=1559, class=0, nrcpts=1, msgid=<[email protected]>, relay=www-data@localhost
Feb 12 09:49:57 ns380959 sendmail[9314]: u1C8nv7O009314: [email protected], ctladdr=www-data (33/33), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=31559, relay=[127.0.0.1] [127.0.0.1], dsn=4.0.0, stat=Deferred: Connection refused by [127.0.0.1]
Feb 12 09:50:01 ns380959 sendmail[9316]: u1C8o1ao009316: from=root, size=20, class=0, nrcpts=1, msgid=<[email protected]>, relay=root@localhost
Feb 12 09:50:01 ns380959 sendmail[9316]: STARTTLS=client, relay=gmail-smtp-in.l.google.com., version=TLSv1/SSLv3, verify=FAIL, cipher=ECDHE-RSA-AES128-GCM-SHA256, bits=128/128
Feb 12 09:50:02 ns380959 sendmail[9316]: u1C8o1ao009316: [email protected], ctladdr=root (0/0), delay=00:00:01, xdelay=00:00:01, mailer=esmtp, pri=30020, relay=gmail-smtp-in.l.google.com. [IPv6:2a00:1450:400c:c06::1a], dsn=5.0.0, stat=Service unavailable
Feb 12 09:53:41 ns380959 sendmail[9494]: u1C8rfYP009494: from=www-data, size=1559, class=0, nrcpts=1, msgid=<[email protected]>, relay=www-data@localhost
Feb 12 09:53:41 ns380959 sendmail[9494]: u1C8rfYP009494: [email protected], ctladdr=www-data (33/33), delay=00:00:00, xdelay=00:00:00, mailer=relay, pri=31559, relay=[127.0.0.1] [127.0.0.1], dsn=4.0.0, stat=Deferred: Connection refused by [127.0.0.1]
我找不到在 sendmail 中更改 127.0.0.1 的位置。我确实在 DAEMON_OPTIONS(`Family=inet, Name=MTA-v4, Port=smtp, Addr=5.xxxx') 中进行了更改,但没有生效。
我应该在哪里更改 sendmail 中的哪些内容才能将邮件发送到 gmail?
我真的不明白如何在这个页面上做事: https://support.google.com/mail/answer/81126?p=ipv6_authentication_error&rd=1#authentication
答案1
正如消息告诉您的那样,2001:41d0:e:4c8::1 没有设置反向 DNS 条目。
要解决此问题,您需要将此的反向 DNS 设置为正确的主机名值,该值也会解析为相同的 IP 地址。您可以在 OVH 管理面板中执行此操作。