Chat bot builder? Go to buzzmark.chat

SMTP error · Any server

535 5.7.8: Authentication failed (SMTP login)

The error as servers send it Permanent - not retried
535 5.7.8 Authentication credentials invalid

IP addresses, domains and links in the line differ per message, and a long reply may be split over several lines.

What it means

You tried to log in to an SMTP server to send mail, and it did not accept the username and password. No message was sent. This error is about your connection to your own outgoing mail server, not about the recipient.

The line above is the standard text. Gmail sends "535-5.7.8 Username and Password not accepted". Postfix sends "535 5.7.8 Error: authentication failed". Microsoft 365 uses a close relative: "535 5.7.139 Authentication unsuccessful".

Usual causes

  • A wrong username or password, often with a space copied in at the start or end.
  • The username is incomplete. Most servers want the full email address or a specific API username.
  • You use your normal Gmail or Google Workspace password. Google accepts only an app password or OAuth for SMTP.
  • SMTP login is switched off for the mailbox or the whole organisation, which is common on Microsoft 365.
  • The password or API token was changed or revoked, and the application still has the old one.
  • You are connecting to the wrong server or port, so valid credentials are checked against the wrong system.
  • Too many failed attempts have locked the account for a while.

How to fix it

  1. Type the credentials again

    Enter the username and password by hand, or paste them into a plain text editor first to spot extra spaces or line breaks. Check that special characters survive in your config file.

  2. Check the username format

    Read your provider's SMTP instructions. Some want your full email address. API-based services often want a fixed username or the token itself.

  3. For Gmail: create an app password

    Turn on 2-Step Verification for the Google account, create an app password and use that 16-character password for SMTP. Your normal password will not work.

  4. For Microsoft 365: enable authenticated SMTP

    An administrator has to enable SMTP AUTH for the mailbox. If the organisation enforces multi-factor sign-in, the application needs OAuth and not a password.

  5. Check host, port and encryption

    Use the server name your provider gives, on port 587 with STARTTLS or port 465 with TLS. Many servers refuse to offer a login on an unencrypted connection.

  6. Issue new credentials

    If nothing else helps, reset the password or create a new API token and update every application that uses it.

Related errors

All SMTP error codes

Rather not do DNS by hand?

Buzzmark is EU-hosted transactional email that generates your SPF, DKIM, DMARC and Return-Path records, checks them for you and warns you if they ever drift.

Free up to 300 emails a month · No credit card