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"
- Enable 2-factor authentication. This is required in order to use less secure apps.
- Navigate to myaccount.google.com/security and scroll down to the "Signing Into Google" section. Click on "App Passwords."
- 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'.
- Copy the generated app password for later usage
Add a few lines on Django settings.py
# 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.