{"record":{"id":"f196c9564983e58d","repo":"PHPMailer/PHPMailer","slug":"smtp-error-could-not-authenticate","errorCode":null,"errorMessage":"SMTP Error: Could not authenticate.","messagePattern":"SMTP Error: Could not authenticate\\.","errorType":"exception","errorClass":"PHPMailer\\PHPMailer\\Exception","httpStatus":null,"severity":"error","filePath":"src/PHPMailer.php","lineNumber":2445,"sourceCode":"                        $tls = true;\n                    }\n                    if ($tls) {\n                        if (!$this->smtp->startTLS()) {\n                            $message = $this->getSmtpErrorMessage('connect_host');\n                            throw new Exception($message);\n                        }\n                        //We must resend EHLO after TLS negotiation\n                        $this->smtp->hello($hello);\n                    }\n                    if (\n                        $this->SMTPAuth && !$this->smtp->authenticate(\n                            $this->Username,\n                            $this->Password,\n                            $this->AuthType,\n                            $this->oauth\n                        )\n                    ) {\n                        throw new Exception(self::lang('authenticate'));\n                    }\n\n                    return true;\n                } catch (Exception $exc) {\n                    $lastexception = $exc;\n                    $this->edebug($exc->getMessage());\n                    //We must have connected, but then failed TLS or Auth, so close connection nicely\n                    $this->smtp->quit();\n                }\n            }\n        }\n        //If we get here, all connection attempts have failed, so close connection hard\n        $this->smtp->close();\n        //As we've caught all exceptions, just report whatever the last one was\n        if ($this->exceptions && null !== $lastexception) {\n            throw $lastexception;\n        }\n        if ($this->exceptions) {","sourceCodeStart":2427,"sourceCodeEnd":2463,"githubUrl":"https://github.com/PHPMailer/PHPMailer/blob/4f7ca1ffa03a437a91001041e35ec1917c9e68c6/src/PHPMailer.php#L2427-L2463","documentation":"Error \"SMTP Error: Could not authenticate.\" thrown in PHPMailer/PHPMailer.","triggerScenarios":"Thrown at src/PHPMailer.php:2445 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4f7ca1ffa03a437a91001041e35ec1917c9e68c6","analyzedAt":"2026-08-17T02:28:38.127Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}