Error when migrate cause by invalid email account credential

When doing bench migrate a site I get this error:

(...the last line...)
File "/usr/lib64/python3.6/smtplib.py", line 642, in auth
    raise SMTPAuthenticationError(code, resp)
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 m21-20020a62a215000000b0050dc7628194sm6745562pff.110 - gsmtp')

During handling of the above exception, another exception occurred:

(...the last line...)
frappe.email.doctype.email_account.email_account.InvalidEmailCredentials: Incorrect email or password. Please check your login credentials.

I even tried to delete all email account and email domain in Settings. But still the same error when migrate the site.

How to resolve this?
Thank you

1 Like

Hi,

Try logging in as Administrator, go to Administration , Users and see if there is a user with an email address that is still active. It may be that a valid domain and account will have to be added.

There is no user that has email inbox set.

This is the first part of the error message:

Traceback (most recent call last):
  File "/home/username/benchname/apps/frappe/frappe/email/smtp.py", line 227, in sess
    ret = self._sess.login(str(self.login or ""), str(self.password or ""))
  File "/usr/lib64/python3.6/smtplib.py", line 730, in login
    raise last_exception
  File "/usr/lib64/python3.6/smtplib.py", line 721, in login
    initial_response_ok=initial_response_ok)
  File "/usr/lib64/python3.6/smtplib.py", line 642, in auth
    raise SMTPAuthenticationError(code, resp)
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 o13-20020a170902d4cd00b0015f15459652sm128269plg.277 - gsmtp')

During handling of the above exception, another exception occurred:

I think it is an account in Settings > Email Account (this is where we set smtp). But I don’t have any email account anymore. So maybe some data is still stuck in database?

After looking at my custom app, I found out that I have fixtures set in the hooks.py.
And and of them is for email account.

When changing the Settings > Email Account I forgot to do bench export-fixtures again, hence the files in fixtures are run again and create the error message.

1 Like

Try bench mariadb and see what

select smtp_server from tabEmail Domain;

returns.

You’re right, it should also be the first way to check.
And an additional from me :

select smtp_server from `tabEmail Account`;