PHPMailer/PHPMailer · error · PHPMailer\PHPMailer\Exception

SMTP Error: Could not authenticate.

Error message

SMTP Error: Could not authenticate.

What it means

Error "SMTP Error: Could not authenticate." thrown in PHPMailer/PHPMailer.

Source

Thrown at src/PHPMailer.php:2445

                        $tls = true;
                    }
                    if ($tls) {
                        if (!$this->smtp->startTLS()) {
                            $message = $this->getSmtpErrorMessage('connect_host');
                            throw new Exception($message);
                        }
                        //We must resend EHLO after TLS negotiation
                        $this->smtp->hello($hello);
                    }
                    if (
                        $this->SMTPAuth && !$this->smtp->authenticate(
                            $this->Username,
                            $this->Password,
                            $this->AuthType,
                            $this->oauth
                        )
                    ) {
                        throw new Exception(self::lang('authenticate'));
                    }

                    return true;
                } catch (Exception $exc) {
                    $lastexception = $exc;
                    $this->edebug($exc->getMessage());
                    //We must have connected, but then failed TLS or Auth, so close connection nicely
                    $this->smtp->quit();
                }
            }
        }
        //If we get here, all connection attempts have failed, so close connection hard
        $this->smtp->close();
        //As we've caught all exceptions, just report whatever the last one was
        if ($this->exceptions && null !== $lastexception) {
            throw $lastexception;
        }
        if ($this->exceptions) {

View on GitHub (pinned to 4f7ca1ffa0)

When it happens

Trigger: Thrown at src/PHPMailer.php:2445 when the library encounters an invalid state.

Common situations: See trigger scenarios.

Understand the failure class


AI-assisted analysis of PHPMailer/PHPMailer@4f7ca1ffa0 (2026-08-17). Data as JSON: /api/errors/f196c9564983e58d. Report an issue: GitHub.