Gmail smtp for sending emails appearantly not working anymore

Using gmail smtp server for sending emails isn’t working anymore / will cease to work ending this month:

Here part of the logs trying to reset my login password:

lms_1                        | 2022-05-06 06:53:19,561 INFO 40 [audit] [user None] [ip xxx.xxx.xxx.xxx] password_reset.py:608 - Password reset initiated for email edx-admin@we-teach-you.academy.
lms_1                        | 2022-05-06 06:53:20,298 ERROR 40 [edx_ace.channel.django_email] [user None] [ip xxx.xxx.xxx.xxx] django_email.py:70 - (535, b'5.7.8 Username and Password not accepted. Learn more at\n5.7.8  https://support.google.com/mail/?p=BadCredentials i3-20020adff303000000b0020c5253d8fcsm3465928wro.72 - gsmtp')
lms_1                        | Traceback (most recent call last):
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/edx_ace/channel/django_email.py", line 68, in deliver
lms_1                        |     mail.send()
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/django/core/mail/message.py", line 284, in send
lms_1                        |     return self.get_connection(fail_silently).send_messages([self])
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/django/core/mail/backends/smtp.py", line 102, in send_messages
lms_1                        |     new_conn_created = self.open()
lms_1                        |   File "/openedx/venv/lib/python3.8/site-packages/django/core/mail/backends/smtp.py", line 69, in open
lms_1                        |     self.connection.login(self.username, self.password)
lms_1                        |   File "/opt/pyenv/versions/3.8.12/lib/python3.8/smtplib.py", line 748, in login
lms_1                        |     raise last_exception
lms_1                        |   File "/opt/pyenv/versions/3.8.12/lib/python3.8/smtplib.py", line 737, in login
lms_1                        |     (code, resp) = self.auth(
lms_1                        |   File "/opt/pyenv/versions/3.8.12/lib/python3.8/smtplib.py", line 660, in auth
lms_1                        |     raise SMTPAuthenticationError(code, resp)
lms_1                        | smtplib.SMTPAuthenticationError: (535, b'5.7.8 Username and Password not accepted. Learn more at\n5.7.8  https://support.google.com/mail/?p=BadCredentials i3-20020adff303000000b0020c5253d8fcsm3465928wro.72 - gsmtp')

And I get an email from Google warning about an invalid login attempt. :unamused:

This was working perfectly before…

Hi @insad ,

I suggest you should use sendinblue or Sendgrid for development. It can replace Gmail SMTP

You can perhaps try create an app-specific password in gmail, you may need to activate 2-factor auth beforehand if it’s not already active
https://security.google.com/settings/security/apppasswords

Do you use corporate gmail account with your own domain name or the free *@gmail.com ones?

The free one. But only required until we’ll mount our own server in some data rack, with fixed IP and configuration of reverse DNS (ARP). If needed I’ll get a cheap mail offering from namecheap, or I’ll ask permission to one of my customers with 4 webservers (which I manage) to send mails using their smtp server. I see also WP plugin has options for XOAUTH2 credentials, I suppose you can get them through the developer console. So maybe find a docker based smtp relay with XOAUTH2 authentication.

@insad I suggest Mailjet as an SMTP relay solution.

That is what we are using in our development setup and we did not hit their monthly or daily free limit during the testing period.

You can simply replace the SMTP_* variables for the Google SMTP configuration with the Mailjet ones.

2 Likes

@uetuluk Thanks for your suggestion. Mailjet works perfect for sending mails during test!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.