I'm following along with this book and in chapter 18 part of the current assignment involves sending an email via Django. I have a yearly domain I use for testing, and rather than pay an additional 5$ a month I figured I'd just have the emails forwarded to an existing address, using these instructions.
I then went ahead and set it up so I could send mail using an alias via the Sending mail from your forwarded email address section
However, I'm unable to get it working using the generated app password + alias. When I try to send an email from the page it only works if 2FA is disabled and I use my actual gmail credentials, say for example:
EMAIL_HOST_USER = 'bob@gmail.com'
EMAIL_HOST_PASSWORD = 'bobswife123'
It works as intended. However, lets say I wanted to use my generated app password and alias, something like:
EMAIL_HOST_USER = 'alias@bob.com'
EMAIL_HOST_PASSWORD = 'bobsmistress123'
Then I'll get the following error:
Was not able to make any use of the support article from the URL in the above screenshot, but here it is for the sake of convenience:
https://support.google.com/mail/?p=BadCredentials
Anyways, these are the exact steps I'm taking:
From terminal on macOS 10.13.1, I run python manage.py runserver
from terminal, and then enter http://localhost:8000/
into Google Chrome. The page displays correctly. I hit enter and try to send the email. Next, it either works, or I get the screenshot shown above. Here's a dpaste of the traceback:
other potentially relevant settings:
EMAIL_HOST = 'smtp.gmail.com
EMAIL_PORT = 465
EMAIL_USE_SSL = True
Any help is greatly appreciated!
Regarding the duplication accusation:
I have already tried the accepted answer's instructions from the potential duplicate. Once again, I can get this to work by using my normal Gmail credentials -- but I don't want to reveal my personal email address, which is why I setup an alias using these instructions. This should allow me to send emails on behalf of the alias domain (which I own)
Edit: Adding my response to user inquiring whether I tried the troubleshooting steps (tl;dr yes i did):
- Update your email client to the latest version.
Not using an email client for this; not applicable - Use an App Password: If you use 2-Step Verification, try signing in with an App Password.
Already addressed this above; kinda what my issue is about - Allow less secure apps: If you don't use 2-Step Verification, you might need to allow less secure apps to access your account.
Allow less secure apps is already enabled. Doesn't work otherwise - If you recently changed your Gmail password, you might need to re-enter your Gmail account information or completely repeat your Gmail account setup on your other email client.
Not related to my gmail password -- it works when I use my actual gmail credentials and I'm able to login to gmail - If the tips above didn't help, visit https://www.google.com/accounts/DisplayUnlockCaptcha and follow the steps on the page.
Already tried this - The email client's sign-in method might be insecure. Try signing in directly on the Gmail app.
Don't think I can use the gmail app in combination with this; not applicable