-
-
Notifications
You must be signed in to change notification settings - Fork 9.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SMTP Error: Could not connect to SMTP host. STARTTLS command failed Unrecognized command 'STARTTLS' #3021
Comments
This is NOT a PHPMailer problem, it is related to either how you have configured SSL and/or TLS. |
And please, from the README file:
|
You have two problems here. Your mail server is misconfigured – while offering a submission service on port 587, it lacks support for STARTTLS, which is an RFC contravention. The second issue is that it supports only GSSAPI and NTLM authentication, neither of which PHPMailer supports. They are largely obsolete; very old versions of PHPMailer used to have NTLM support, but it was dropped years ago. Separately from these issues, this server is insecure because it advertises authentication methods without requiring encryption first, and these authentication schemes are not considered secure over unencrypted channels. In short, you need a better mail server. As @XL-2000 said, don't disable certificate validation. Here it's irrelevant because the server doesn't provide certificates anyway, but you shouldn't be doing it anyway. |
I started by defaulting to not disabling the certificate, and got the same result: |
The same code could be sent normally before. |
Yes, that's why I said the ssl settings were irrelevant – you have no encryption, so there is no certificate to verify, so changing verification settings won't make any difference. If you don't change anything in your script, then the mail server must have changed. It would not surprise me if it's an obsolete server; it's really common for MS servers to be many years out of date, and a patch update can break things. asp.net is a proprietary Microsoft product and as such provides support for proprietary Microsoft protocols like GSSAPI and NTLM. If you need to maintain compatibility with them, switch to asp.net; you're not going to get support for them here. |
Is it necessary to configure the mail server certificate to deal with this problem? |
Yes, you need to ask them to do these things:
|
OK, thank you very much for your answer
|
2024-02-20 07:57:32 Connection: opening to webmail.mydomain.com:587, timeout=300, options=array ( 'ssl' => array ( 'verify_peer' => false, 'verify_peer_name' => false, 'allow_self_signed' => true, ),)
2024-02-20 07:57:32 Connection: opened
2024-02-20 07:57:32 SMTP INBOUND: "220 webmail.mydomain.com Microsoft ESMTP MAIL Service ready at Tue, 20 Feb 2024 15:57:31 +0800"
2024-02-20 07:57:32 SERVER -> CLIENT: 220 webmail.mydomain.com Microsoft ESMTP MAIL Service ready at Tue, 20 Feb 2024 15:57:31 +0800
2024-02-20 07:57:32 CLIENT -> SERVER: EHLO client.macaupage.com
2024-02-20 07:57:32 SMTP INBOUND: "250-webmail.mydomain.com Hello [mydomain.com IP]"
2024-02-20 07:57:32 SMTP INBOUND: "250-SIZE 37748736"
2024-02-20 07:57:32 SMTP INBOUND: "250-PIPELINING"
2024-02-20 07:57:32 SMTP INBOUND: "250-DSN"
2024-02-20 07:57:32 SMTP INBOUND: "250-ENHANCEDSTATUSCODES"
2024-02-20 07:57:32 SMTP INBOUND: "250-AUTH GSSAPI NTLM"
2024-02-20 07:57:32 SMTP INBOUND: "250-8BITMIME"
2024-02-20 07:57:32 SMTP INBOUND: "250-BINARYMIME"
2024-02-20 07:57:32 SMTP INBOUND: "250-CHUNKING"
2024-02-20 07:57:32 SMTP INBOUND: "250 SMTPUTF8"
2024-02-20 07:57:32 SERVER -> CLIENT: 250-webmail.mydomain.com Hello [mydomain.com IP]250-SIZE 37748736250-PIPELINING250-DSN250-ENHANCEDSTATUSCODES250-AUTH GSSAPI NTLM250-8BITMIME250-BINARYMIME250-CHUNKING250 SMTPUTF8
2024-02-20 07:57:32 CLIENT -> SERVER: STARTTLS
2024-02-20 07:57:37 SMTP INBOUND: "500 5.3.3 Unrecognized command 'STARTTLS'"
2024-02-20 07:57:37 SERVER -> CLIENT: 500 5.3.3 Unrecognized command 'STARTTLS'
2024-02-20 07:57:37 SMTP ERROR: STARTTLS command failed: 500 5.3.3 Unrecognized command 'STARTTLS'
SMTP Error: Could not connect to SMTP host. STARTTLS command failed Unrecognized command 'STARTTLS'
2024-02-20 07:57:37 CLIENT -> SERVER: QUIT
2024-02-20 07:57:37 SMTP INBOUND: "221 2.0.0 Service closing transmission channel"
2024-02-20 07:57:37 SERVER -> CLIENT: 221 2.0.0 Service closing transmission channel
2024-02-20 07:57:37 Connection: closed
SMTP Error: Could not connect to SMTP host. STARTTLS command failed Unrecognized command 'STARTTLS'
Message could not be sent. Mailer Error: SMTP Error: Could not connect to SMTP host. STARTTLS command failed Unrecognized command 'STARTTLS'
The text was updated successfully, but these errors were encountered: