fastapi_mail.errors.ConnectionErrors on gmail smtp

See original GitHub issue

I am getting the following error when trying the first basic example here:

fastapi_mail.errors.ConnectionErrors: Exception raised (535, '5.7.8 Username and Password not accepted. Learn more at\n5.7.8 https://support.google.com/mail/?p=BadCredentials l33-20020a0568302b2100b005cdad9100desm5879477otv.40 - gsmtp'), check your credentials or email service configuration

MAIL_USERNAME=asd
MAIL_PASSWORD=<16-digit app password generated in gmail admin, 2step verification enabled>
MAIL_FROM=<matching email>
MAIL_PORT=587
MAIL_SERVER=smtp.gmail.com
MAILFROM_NAME=asd
MAIL_TLS=1
MAIL_SSL=0
USE_CREDENTIALS=1
VALIDATE_CERTS=1

I tried with personal mail/pwd for testing and didn’t work. Then I tried with validated mail/pwd currently being used in production on another (flask) app and it didn’t work.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
sabuhishcommented, Apr 17, 2022

I think we are all good with finding and resolving the issue, I will kindly close the issue if you face another issue feel free to open it. And thanks @filipagh for your help also.

0reactions
sabuhishcommented, Apr 17, 2022

Hi there! Locally should everything work fine, being said that you don’t need to run your application with a TLS certificate unless your mail configuration requires it and you may have to set it while establishing connection. MAIL_FROM_NAME parameter is used to specify upon receiving the email to show from whom you have received the email. MAIL_USERNAME is the one that needs to be specified for establishing connections. You have to set this parameter. MAIL_FROM has been set, because some email providers use different sender email addresses, this param is not used for connection at all but MAIL_USERNAME does do that.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Login credentials not working with Gmail SMTP - Stack Overflow
I got an SMTP Authentication Error but my user name / pass was correct. ... UPDATE:: See my answer here: How to send...
Read more >
Enabling UTF-8 · Issue #55 · sabuhish/fastapi-mail - GitHub
... when my SMTP password contains a currency symbol (€) which results in the following error: fastapi_mail.errors.ConnectionErrors: Except.
Read more >
FASTAPI MAIL : r/FastAPI - Reddit
How to resolve this? I used my Gmail account in the Connection config class. fastapi_mail.errors.ConnectionErrors: Exception raised (534, ...
Read more >
Quick fix for SMTP username and password not accepted error
Error : 535-5.7.8 Username and Password not accepted has become an common error for developers trying to connect to Googles smtp server.
Read more >
fastapi-mail - PyPI
sending emails using FastApi background task managment; sending files either from form-data or files from server; Using Jinja2 HTML Templates; email utils ( ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found