Setup Django Application Form to send emails to your Gmail Inbox

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 ab…


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:

  1. https://myaccount.google.com/
  2. Under "Recent Security Activity" make sure 2FA is on
  3. 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..."

  1. 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


Print Share Comment Cite Upload Translate Updates
APA

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/

MLA
" » Setup Django Application Form to send emails to your Gmail Inbox." Sayem Hoque | Sciencx - Monday September 16, 2024, https://www.scien.cx/2024/09/16/setup-django-application-form-to-send-emails-to-your-gmail-inbox/
HARVARD
Sayem Hoque | Sciencx Monday September 16, 2024 » Setup Django Application Form to send emails to your Gmail Inbox., viewed ,<https://www.scien.cx/2024/09/16/setup-django-application-form-to-send-emails-to-your-gmail-inbox/>
VANCOUVER
Sayem Hoque | Sciencx - » Setup Django Application Form to send emails to your Gmail Inbox. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2024/09/16/setup-django-application-form-to-send-emails-to-your-gmail-inbox/
CHICAGO
" » Setup Django Application Form to send emails to your Gmail Inbox." Sayem Hoque | Sciencx - Accessed . https://www.scien.cx/2024/09/16/setup-django-application-form-to-send-emails-to-your-gmail-inbox/
IEEE
" » Setup Django Application Form to send emails to your Gmail Inbox." Sayem Hoque | Sciencx [Online]. Available: https://www.scien.cx/2024/09/16/setup-django-application-form-to-send-emails-to-your-gmail-inbox/. [Accessed: ]
rf:citation
» Setup Django Application Form to send emails to your Gmail Inbox | Sayem Hoque | Sciencx | 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.

You must be logged in to translate posts. Please log in or register.