"Failed to send email. Reason: Invalid login"

I’m trying to send an invitation to my brother so he can join as an administrator, but every time I send the invite, I get this error in the dashboard:

Error sending email! Error sending email: Failed to send email. Reason: Invalid login - 535 Authentication failed: The provided authorization grant is invalid, expired, or revoked. Please check your email settings and resend the invitation.

I also get these errors in my Ghost logs:

[2020-06-12 23:54:10] ERROR "POST /ghost/api/v3/admin/invites/" 500 579ms

Error sending email: Failed to send email. Reason: Invalid login - 535 Authentication failed: The provided authorization grant is invalid, expired, or revoked. Please check your email settings and resend the invitation.                  

"Please see https://ghost.org/docs/concepts/config/#mail for instructions on configuring email."

Error ID:
    0292cc20-ad08-11ea-b2c8-d11b4f6896eb

----------------------------------------

EmailError: Failed to send email. Reason: Invalid login - 535 Authentication failed: The provided authorization grant is invalid, expired, or revoked.
    at EmailError.GhostError (/var/lib/ghost/versions/3.19.2/node_modules/@tryghost/errors/lib/errors.js:10:26)                                                                                                                              
    at new EmailError (/var/lib/ghost/versions/3.19.2/node_modules/@tryghost/errors/lib/errors.js:34:20)                                                                                                                                     
    at createMailError (/var/lib/ghost/versions/3.19.2/core/server/services/mail/GhostMailer.js:51:12)                                                                                                                                       
    at MailComposer.returnCallback (/var/lib/ghost/versions/3.19.2/core/server/services/mail/GhostMailer.js:93:28)                                                                                                                           
    at SMTPConnectionPool._onConnectionError (/var/lib/ghost/versions/3.19.2/node_modules/simplesmtp/lib/pool.js:334:17)                                                                                                                     
    at SMTPClient.emit (events.js:315:20)
    at SMTPClient.EventEmitter.emit (domain.js:482:12)
    at SMTPClient._onError (/var/lib/ghost/versions/3.19.2/node_modules/simplesmtp/lib/client.js:373:10)
    at SMTPClient._actionAUTHComplete (/var/lib/ghost/versions/3.19.2/node_modules/simplesmtp/lib/client.js:925:14)
    at SMTPClient._onData (/var/lib/ghost/versions/3.19.2/node_modules/simplesmtp/lib/client.js:354:29)
    at TLSSocket.emit (events.js:315:20)
    at TLSSocket.EventEmitter.emit (domain.js:482:12)
    at addChunk (_stream_readable.js:295:12)
    at readableAddChunk (_stream_readable.js:271:9)
    at TLSSocket.Readable.push (_stream_readable.js:212:10)
    at TLSWrap.onStreamRead (internal/stream_base_commons.js:186:23)

AuthError: Invalid login - 535 Authentication failed: The provided authorization grant is invalid, expired, or revoked
    at SMTPClient._actionAUTHComplete (/var/lib/ghost/versions/3.19.2/node_modules/simplesmtp/lib/client.js:925:23)
    at SMTPClient._onData (/var/lib/ghost/versions/3.19.2/node_modules/simplesmtp/lib/client.js:354:29)
    at TLSSocket.emit (events.js:315:20)
    at TLSSocket.EventEmitter.emit (domain.js:482:12)
    at addChunk (_stream_readable.js:295:12)
    at readableAddChunk (_stream_readable.js:271:9)
    at TLSSocket.Readable.push (_stream_readable.js:212:10)
    at TLSWrap.onStreamRead (internal/stream_base_commons.js:186:23)

This is my SMTP configuration, using environment variables in my docker-compose.yml:

mail__transport: "SMTP"
mail__options__service: "Sendgrid"
mail__options__host: "smtp.sendgrid.net"
mail__options__port: 465
mail__options__secureConnection: "true"
mail__options__auth__user: "apikey"
mail__options__auth__pass: "REDACTED"
mail__from: "mail@scrapjackstudios.com"
1 Like

Seems like problem with your api key… check your api key or recreate new one…

to be more sure thats the api is invalid try with your Sendgrid username & password in mail__options__auth__user & mail__options__auth__pass

1 Like

Uh, shit. It worked with my real username and password. I don’t think that’s supposed to happen.

Glad it worked

Yeah, but I’m wondering why. It shouldn’t have without my API key.

By default sendgrid smtp works with accounts username & password. Your API key didn’t worked may be API key was invalid or your ip wasn’t whitelisted…

Yeah. I guess.

How to find the error logs?

I am not able to send “bulk emails” with correctly configured domains. Mailgun is asking for error logs.

1 Like

How are you seeing logs? I’m having a ton of errors (in the UI) and I have no idea why. And I don’t have any logs to see why.