This content originally appeared on DEV Community and was authored by Sayem Hoque
For September 2024 none of the guides I found online were up to date and comprehensive for this so just writing the steps to make it work here:
- https://myaccount.google.com/
- Under "Recent Security Activity" make sure 2FA is on
- Go to the search bar above, and search "App Passwords"
You'll be prompted as such - "To create a new app specific password, type a name for it below..."
- Name it something like "my-django-site-form"
It will generate a password you can use in your application. Store this securely somewhere. This can be used in your Django settings, but I opt for saving as an .env variable.
To test to make sure this setup is working, you can run the following code in the Django shell:
python manage.py shell
from django.core.mail import send_mail
send_mail(
'Test Email',
'This is a test email.',
'sender@email.com',
['recipient@example.com'],
fail_silently=False,
)
Replace the two emails, and you should see an email sent to recipient@example.com
This content originally appeared on DEV Community and was authored by Sayem Hoque
Sayem Hoque | Sciencx (2024-09-16T02:28:39+00:00) Setup Django Application Form to send emails to your Gmail Inbox. Retrieved from https://www.scien.cx/2024/09/16/setup-django-application-form-to-send-emails-to-your-gmail-inbox/
Please log in to upload a file.
There are no updates yet.
Click the Upload button above to add an update.