The error message (535, b'5.7.8 Username and Password not accepted.') indicates that the SMTP server is rejecting your credentials. Some steps you should recheck:
Enable Less Secure Apps (for Gmail)
If you're using a Gmail account, ensure that "Less Secure Apps" is enabled in your Google Account settings. This setting allows third-party apps to access your Gmail account.
Go to: Google Less Secure Apps and enable it.
Use an App Password (if 2FA is enabled)
If you have Two-Factor Authentication (2FA) enabled on your Google Account, you cannot use your regular password for SMTP. Instead, you need to generate an App Password.
Go to: Google App Passwords, generate an app password, and use it in your code instead of your regular password.