Another thing to look out for here is that the name the mail server responds with should be related to the server you requested, as you can see in the above example - we asked for , which looks like it's something to do with google - if instead you see something like the name of your ISP, then it could mean that your ISP's firewall is redirecting you transparently to their own mail servers, and you're likely to see authentication and TLS certificate verification failures (see below for more) because you're logging into the wrong server.This is very likely to happen on port 25, but less likely to happen on ports 465 and 587, so it's yet another reason to use encryption!It's particularly important to use composer if you're using XOAUTH2 authentication since it requires many dependent classes that are satisfied by composer.The dependencies are not included by default because they are not needed by everyone and they don't work on the older PHP versions that PHPMailer supports, so you will find them in the 'suggest' section of PHPMailer's To fix this either configure composer as described or download this class and all its dependencies and load them manually yourself. Not so long ago, PHPMailer changed the way that it loaded classes so that it was more compatible with composer, many frameworks, and the PHP PSR-0 autoloading standard.If your authentication is failing, there are several likely causes: Generally, you do not want to send a username or password over an unencrypted link.Some SMTP authentication schemes do add a minimal level of security (sending short hashes rather than clear text), but these provide only minimal protection, and so most servers do not allow authentication without encryption. From December 2014, Google started imposing an authentication mechanism called XOAUTH2 based on OAuth2 for access to their apps, including Gmail.
These are often seen as connection timeouts, or "Temporary failure in name resolution", "could not resolve host", "getaddrinfo failed" or similar errors.
You may have seen old scripts doing this: in debug output.