Code Monkey home page Code Monkey logo

Comments (9)

XL-2000 avatar XL-2000 commented on June 2, 2024

This is NOT a PHPMailer problem, it is related to either how you have configured SSL and/or TLS.
It may be related to the certificates you are using, and/or the config on the SMTP server.
Also, please note that you are providing the LEAST secure SSL option, which is not recommended.
Please, when done testing, revert to
'verify_peer' => true, 'verify_peer_name' => true, 'allow_self_signed' => false

from phpmailer.

XL-2000 avatar XL-2000 commented on June 2, 2024

And please, from the README file:

and before you ask a question about "SMTP Error: Could not connect to SMTP host.", read the troubleshooting guide (https://github.com/PHPMailer/PHPMailer/wiki/Troubleshooting).

from phpmailer.

Synchro avatar Synchro commented on June 2, 2024

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.

from phpmailer.

abin2011 avatar abin2011 commented on June 2, 2024

I started by defaulting to not disabling the certificate, and got the same result:
SMTP Error: Could not connect to SMTP host. STARTTLS command failed Unrecognized command 'STARTTLS'
Change the parameters to this: 'verify_peer' => true, 'verify_peer_name' => true, 'allow_self_signed' => false and the result is the same.

from phpmailer.

abin2011 avatar abin2011 commented on June 2, 2024

The same code could be sent normally before.
But a few days ago, it suddenly stopped working. Because the SMTP for email is provided by the customer, we have no way to set it up. However, the customer reported that using asp.net, the SMTP service can be used to send emails normally.

from phpmailer.

Synchro avatar Synchro commented on June 2, 2024

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.

from phpmailer.

abin2011 avatar abin2011 commented on June 2, 2024

Is it necessary to configure the mail server certificate to deal with this problem?
How should I describe how to fix this smtp service?
So how else can I use the smtp service to send emails?

from phpmailer.

Synchro avatar Synchro commented on June 2, 2024

Yes, you need to ask them to do these things:

  • Enable encryption (STARTTLS on port 587 and SMTPS on port 465)
  • Require encryption before authentication (that they are not doing this already is a bad sign)
  • Enable support for standard LOGIN and/or PLAIN authentication schemes

from phpmailer.

abin2011 avatar abin2011 commented on June 2, 2024

OK, thank you very much for your answer

Yes, you need to ask them to do these things:

  • Enable encryption (STARTTLS on port 587 and SMTPS on port 465)
  • Require encryption before authentication (that they are not doing this already is a bad sign)
  • Enable support for standard LOGIN and/or PLAIN authentication schemes

from phpmailer.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.