Whatever Whenever Tech insights, coding tips, and AI stuff
Home New Post
Profile
Login Register

Select a category for your post

Click tags to select/deselect

Markdown supported: # Heading, **bold**, *italic*, `code`, - list items, etc.
Tip: Paste images directly from clipboard or drag-and-drop to upload!

How to send out emails with Django using Gmail.
Setup a Gmail "App Password"

  1. Enable 2-factor authentication. This is required in order to use less secure apps.
  2. Navigate to myaccount.google.com/security and scroll down to the "Signing Into Google" section. Click on "App Passwords."
  3. You'll be asked to enter your personal Gmail account password. Next, click on "Select App" and input a name for your Django app. Generate an 'App Password'.
  4. Copy the generated app password for later usage

Add a few lines on Django settings.py

python
# Gmail Example
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER = 'your_username@gmail.com'
EMAIL_HOST_PASSWORD = 'generated_app_password_from_above'
EMAIL_PORT = 587
EMAIL_USE_TLS = True
EMAIL_USE_SSL = False

It's recommended that we don't put secret information such as email password on settings.py. Please refer to How to Use Python Decouple Library for Django Application for more.

Cancel

Add New Category

Add New Tag

Home Search | RSS Sitemap

© 2026 whatever.asia