为什么最新的 PHP 邮件程序无法在 Bamboozle 上运行?
Why latest PHP mailer not working on Bamboozle?
几天来我一直在使用最新的 php 邮件程序。我尝试过切换代码、删除线路、将 smtp 安全性从 tls 更改为 ssl 以及更改端口,但没有任何效果。我正在使用我的 office 365 smtp 设置和凭据,它们都是有效且合法的。值得注意的是,相同的代码、php 邮件程序和 smtp 设置适用于托管程序。
这就是我得到的
2022-05-22 08:01:37 Connection: opening to smtp.office365.com:587, timeout=300,
options=array()
2022-05-22 08:01:39 Connection: opened
2022-05-22 08:01:39 SERVER -> CLIENT: 220-cp-dxb-001.bamboozle.me ESMTP Exim 4.95 #2 Sun, 22
May 2022 12:01:39 +0400 220-We do not authorize the use of this system to transport
unsolicited, 220 and/or bulk e-mail.
2022-05-22 08:01:39 CLIENT -> SERVER: EHLO eighty6.shop
2022-05-22 08:01:39 SERVER -> CLIENT: 250-cp-dxb-001.bamboozle.me Hello eighty6.shop
[185.93.244.110]250-SIZE 52428800250-8BITMIME250-PIPELINING250-PIPE_CONNECT250-AUTH PLAIN
LOGIN250-STARTTLS250 HELP
2022-05-22 08:01:39 CLIENT -> SERVER: STARTTLS
2022-05-22 08:01:39 SERVER -> CLIENT: 220 TLS go ahead
2022-05-22 08:01:39 Connection failed. Error #2: stream_socket_enable_crypto(): Peer
certificate CN=`cp-dxb-001.bamboozle.me' did not match expected CN=`smtp.office365.com'
[/home/eightysh/public_html/vendor/phpmailer/phpmailer/src/SMTP.php line 468]
SMTP Error: Could not connect to SMTP host. Connection failed. stream_socket_enable_crypto():
Peer certificate CN=`cp-dxb-001.bamboozle.me' did not match expected CN=`smtp.office365.com'
2022-05-22 08:01:39 CLIENT -> SERVER: QUIT
2022-05-22 08:01:39
2022-05-22 08:01:39
2022-05-22 08:01:39 Connection: closed
SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
与此同时,在我的托管商上我得到了
2022-05-22 07:22:09 Connection: opening to smtp.office365.com:587, timeout=300,
options=array()
2022-05-22 07:22:09 Connection: opened
2022-05-22 07:22:09 SERVER -> CLIENT: 220 LO4P123CA0320.outlook.office365.com Microsoft ESMTP
MAIL Service ready at Sun, 22 May 2022 07:22:09 +0000
2022-05-22 07:22:09 CLIENT -> SERVER: EHLO 86.tamvice.com
2022-05-22 07:22:09 SERVER -> CLIENT: 250-LO4P123CA0320.outlook.office365.com Hello
[2a02:4780:a:1::3]250-SIZE 157286400250-PIPELINING250-DSN250-ENHANCEDSTATUSCODES250-
STARTTLS250-8BITMIME250-BINARYMIME250-CHUNKING250 SMTPUTF8
2022-05-22 07:22:09 CLIENT -> SERVER: STARTTLS
2022-05-22 07:22:09 SERVER -> CLIENT: 220 2.0.0 SMTP server ready
2022-05-22 07:22:09 CLIENT -> SERVER: EHLO 86.tamvice.com
2022-05-22 07:22:09 SERVER -> CLIENT: 250-LO4P123CA0320.outlook.office365.com Hello
[2a02:4780:a:1::3]250-SIZE 157286400250-PIPELINING250-DSN250-ENHANCEDSTATUSCODES250-AUTH LOGIN
XOAUTH2250-8BITMIME250-BINARYMIME250-CHUNKING250 SMTPUTF8
2022-05-22 07:22:09 CLIENT -> SERVER: AUTH LOGIN
2022-05-22 07:22:09 SERVER -> CLIENT: 334 VXNlcm5hbWU6
2022-05-22 07:22:09 CLIENT -> SERVER: [credentials hidden]
2022-05-22 07:22:09 SERVER -> CLIENT: 334 UGFzc3dvcmQ6
2022-05-22 07:22:09 CLIENT -> SERVER: [credentials hidden]
2022-05-22 07:22:13 SERVER -> CLIENT: 235 2.7.0 Authentication successful
2022-05-22 07:22:13 CLIENT -> SERVER: MAIL FROM:<sales@eighty6.shop>
2022-05-22 07:22:14 SERVER -> CLIENT: 250 2.1.0 Sender OK
2022-05-22 07:22:14 CLIENT -> SERVER: RCPT TO:<baltajiwissam@gmail.com>
2022-05-22 07:22:14 SERVER -> CLIENT: 250 2.1.5 Recipient OK
2022-05-22 07:22:14 CLIENT -> SERVER: DATA
2022-05-22 07:22:14 SERVER -> CLIENT: 354 Start mail input; end with <CRLF>.<CRLF>
2022-05-22 07:22:14 CLIENT -> SERVER: Date: Sun, 22 May 2022 07:22:09 +0000
2022-05-22 07:22:14 CLIENT -> SERVER: To: baltajiwissam@gmail.com
2022-05-22 07:22:14 CLIENT -> SERVER: From: First Last <sales@eighty6.shop>
2022-05-22 07:22:14 CLIENT -> SERVER: Reply-To: wissam baltaji <baltajiwissam@gmail.com>
2022-05-22 07:22:14 CLIENT -> SERVER: Subject: PHPMailer contact form
2022-05-22 07:22:14 CLIENT -> SERVER: Message-ID:
<w5lm4Is8xRkxaQORZBqfRsPMfsSwDXihsjtIdFWMSM@86.tamvice.com>
2022-05-22 07:22:14 CLIENT -> SERVER: X-Mailer: PHPMailer 6.6.0
(https://github.com/PHPMailer/PHPMailer)
2022-05-22 07:22:14 CLIENT -> SERVER: MIME-Version: 1.0
2022-05-22 07:22:14 CLIENT -> SERVER: Content-Type: text/plain; charset=iso-8859-1
2022-05-22 07:22:14 CLIENT -> SERVER:
2022-05-22 07:22:14 CLIENT -> SERVER: Email: baltajiwissam@gmail.com
2022-05-22 07:22:14 CLIENT -> SERVER: Name: wissam baltaji
2022-05-22 07:22:14 CLIENT -> SERVER: Message: 4r4r4r4r4r4r
2022-05-22 07:22:14 CLIENT -> SERVER:
2022-05-22 07:22:14 CLIENT -> SERVER: .
2022-05-22 07:22:14 SERVER -> CLIENT: 250 2.0.0 OK
<w5lm4Is8xRkxaQORZBqfRsPMfsSwDXihsjtIdFWMSM@86.tamvice.com>
[Hostname=DX1P273MB0952.AREP273.PROD.OUTLOOK.COM]
2022-05-22 07:22:14 CLIENT -> SERVER: QUIT
2022-05-22 07:22:14 SERVER -> CLIENT: 221 2.0.0 Service closing transmission channel
2022-05-22 07:22:14 Connection: closed
您遇到的根本问题与您尝试使用 gmail 时的问题完全相同。您的托管服务提供商正在重定向您的 SMTP 流量,并且他们的证书与您要求的主机名不匹配,因此拒绝连接。这正是 TLS 在做它应该做的事情,因为通过这样做,他们可以有效地对您的流量执行 machine-in-the-middle 攻击,并且它可以保护您免受攻击。
解决方法和你上次问的完全一样。请改用他们的邮件服务器(这将阻止您使用您的发件人地址),要求他们允许出站 SMTP 而无需此重定向,或者使用更好的托管服务提供商。
几天来我一直在使用最新的 php 邮件程序。我尝试过切换代码、删除线路、将 smtp 安全性从 tls 更改为 ssl 以及更改端口,但没有任何效果。我正在使用我的 office 365 smtp 设置和凭据,它们都是有效且合法的。值得注意的是,相同的代码、php 邮件程序和 smtp 设置适用于托管程序。 这就是我得到的
2022-05-22 08:01:37 Connection: opening to smtp.office365.com:587, timeout=300,
options=array()
2022-05-22 08:01:39 Connection: opened
2022-05-22 08:01:39 SERVER -> CLIENT: 220-cp-dxb-001.bamboozle.me ESMTP Exim 4.95 #2 Sun, 22
May 2022 12:01:39 +0400 220-We do not authorize the use of this system to transport
unsolicited, 220 and/or bulk e-mail.
2022-05-22 08:01:39 CLIENT -> SERVER: EHLO eighty6.shop
2022-05-22 08:01:39 SERVER -> CLIENT: 250-cp-dxb-001.bamboozle.me Hello eighty6.shop
[185.93.244.110]250-SIZE 52428800250-8BITMIME250-PIPELINING250-PIPE_CONNECT250-AUTH PLAIN
LOGIN250-STARTTLS250 HELP
2022-05-22 08:01:39 CLIENT -> SERVER: STARTTLS
2022-05-22 08:01:39 SERVER -> CLIENT: 220 TLS go ahead
2022-05-22 08:01:39 Connection failed. Error #2: stream_socket_enable_crypto(): Peer
certificate CN=`cp-dxb-001.bamboozle.me' did not match expected CN=`smtp.office365.com'
[/home/eightysh/public_html/vendor/phpmailer/phpmailer/src/SMTP.php line 468]
SMTP Error: Could not connect to SMTP host. Connection failed. stream_socket_enable_crypto():
Peer certificate CN=`cp-dxb-001.bamboozle.me' did not match expected CN=`smtp.office365.com'
2022-05-22 08:01:39 CLIENT -> SERVER: QUIT
2022-05-22 08:01:39
2022-05-22 08:01:39
2022-05-22 08:01:39 Connection: closed
SMTP connect() failed. https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting
与此同时,在我的托管商上我得到了
2022-05-22 07:22:09 Connection: opening to smtp.office365.com:587, timeout=300,
options=array()
2022-05-22 07:22:09 Connection: opened
2022-05-22 07:22:09 SERVER -> CLIENT: 220 LO4P123CA0320.outlook.office365.com Microsoft ESMTP
MAIL Service ready at Sun, 22 May 2022 07:22:09 +0000
2022-05-22 07:22:09 CLIENT -> SERVER: EHLO 86.tamvice.com
2022-05-22 07:22:09 SERVER -> CLIENT: 250-LO4P123CA0320.outlook.office365.com Hello
[2a02:4780:a:1::3]250-SIZE 157286400250-PIPELINING250-DSN250-ENHANCEDSTATUSCODES250-
STARTTLS250-8BITMIME250-BINARYMIME250-CHUNKING250 SMTPUTF8
2022-05-22 07:22:09 CLIENT -> SERVER: STARTTLS
2022-05-22 07:22:09 SERVER -> CLIENT: 220 2.0.0 SMTP server ready
2022-05-22 07:22:09 CLIENT -> SERVER: EHLO 86.tamvice.com
2022-05-22 07:22:09 SERVER -> CLIENT: 250-LO4P123CA0320.outlook.office365.com Hello
[2a02:4780:a:1::3]250-SIZE 157286400250-PIPELINING250-DSN250-ENHANCEDSTATUSCODES250-AUTH LOGIN
XOAUTH2250-8BITMIME250-BINARYMIME250-CHUNKING250 SMTPUTF8
2022-05-22 07:22:09 CLIENT -> SERVER: AUTH LOGIN
2022-05-22 07:22:09 SERVER -> CLIENT: 334 VXNlcm5hbWU6
2022-05-22 07:22:09 CLIENT -> SERVER: [credentials hidden]
2022-05-22 07:22:09 SERVER -> CLIENT: 334 UGFzc3dvcmQ6
2022-05-22 07:22:09 CLIENT -> SERVER: [credentials hidden]
2022-05-22 07:22:13 SERVER -> CLIENT: 235 2.7.0 Authentication successful
2022-05-22 07:22:13 CLIENT -> SERVER: MAIL FROM:<sales@eighty6.shop>
2022-05-22 07:22:14 SERVER -> CLIENT: 250 2.1.0 Sender OK
2022-05-22 07:22:14 CLIENT -> SERVER: RCPT TO:<baltajiwissam@gmail.com>
2022-05-22 07:22:14 SERVER -> CLIENT: 250 2.1.5 Recipient OK
2022-05-22 07:22:14 CLIENT -> SERVER: DATA
2022-05-22 07:22:14 SERVER -> CLIENT: 354 Start mail input; end with <CRLF>.<CRLF>
2022-05-22 07:22:14 CLIENT -> SERVER: Date: Sun, 22 May 2022 07:22:09 +0000
2022-05-22 07:22:14 CLIENT -> SERVER: To: baltajiwissam@gmail.com
2022-05-22 07:22:14 CLIENT -> SERVER: From: First Last <sales@eighty6.shop>
2022-05-22 07:22:14 CLIENT -> SERVER: Reply-To: wissam baltaji <baltajiwissam@gmail.com>
2022-05-22 07:22:14 CLIENT -> SERVER: Subject: PHPMailer contact form
2022-05-22 07:22:14 CLIENT -> SERVER: Message-ID:
<w5lm4Is8xRkxaQORZBqfRsPMfsSwDXihsjtIdFWMSM@86.tamvice.com>
2022-05-22 07:22:14 CLIENT -> SERVER: X-Mailer: PHPMailer 6.6.0
(https://github.com/PHPMailer/PHPMailer)
2022-05-22 07:22:14 CLIENT -> SERVER: MIME-Version: 1.0
2022-05-22 07:22:14 CLIENT -> SERVER: Content-Type: text/plain; charset=iso-8859-1
2022-05-22 07:22:14 CLIENT -> SERVER:
2022-05-22 07:22:14 CLIENT -> SERVER: Email: baltajiwissam@gmail.com
2022-05-22 07:22:14 CLIENT -> SERVER: Name: wissam baltaji
2022-05-22 07:22:14 CLIENT -> SERVER: Message: 4r4r4r4r4r4r
2022-05-22 07:22:14 CLIENT -> SERVER:
2022-05-22 07:22:14 CLIENT -> SERVER: .
2022-05-22 07:22:14 SERVER -> CLIENT: 250 2.0.0 OK
<w5lm4Is8xRkxaQORZBqfRsPMfsSwDXihsjtIdFWMSM@86.tamvice.com>
[Hostname=DX1P273MB0952.AREP273.PROD.OUTLOOK.COM]
2022-05-22 07:22:14 CLIENT -> SERVER: QUIT
2022-05-22 07:22:14 SERVER -> CLIENT: 221 2.0.0 Service closing transmission channel
2022-05-22 07:22:14 Connection: closed
您遇到的根本问题与您尝试使用 gmail 时的问题完全相同。您的托管服务提供商正在重定向您的 SMTP 流量,并且他们的证书与您要求的主机名不匹配,因此拒绝连接。这正是 TLS 在做它应该做的事情,因为通过这样做,他们可以有效地对您的流量执行 machine-in-the-middle 攻击,并且它可以保护您免受攻击。
解决方法和你上次问的完全一样。请改用他们的邮件服务器(这将阻止您使用您的发件人地址),要求他们允许出站 SMTP 而无需此重定向,或者使用更好的托管服务提供商。