Setup gmail for sending emails in django (Easy way)

1. Enable 2 factor authentication

  • In order to proceed, you need to enable 2fa (aka 2 factor authentication) in your gmail account. In case you are finding difficulties in doing this you can refer the following article by clicking here.

2. Creating app password

  • For this step select “ Manage your google account option”.
  • Now you will be shown something like this:
  • Now as shown in the image above, click on the security option.
  • In security tab under Signing in to Google you will find something called App passwords, click on that
  • It would ask for verification, after completing that you will be shown the following:
  • Now click on the select app dropdown, click on other (custom name) and then give it a name.
  • And then click on the generate button and you will be shown a popup with a 16 character password.
  • Make sure you write this password somewhere because it will be displayed only once.
  • And that’s it here comes the final step.

3. Setting up the gmail setting in file (django)

  • Now copy paste the following in django
EMAIL_BACKEND = ‘django.core.mail.backends.smtp.EmailBackend’
EMAIL_HOST_PASSWORD = ‘The app password that you have taken down’




webdeveloper and programmer

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

EPNS Rockstar winner via Governance

Kingswap Defi

How to Add a Custom Skybox

Life is a journey of twists and turns, peaks and valleys, mountains to climb and oceans to explore.

ngrok Quick Start and Basics

Cheapest professional web hosting on the market.

How to Install WordPress with LAMP Stack on CentOS 8

Deploying a Dash App on Heroku; My First Time Experience

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store


webdeveloper and programmer

More from Medium


How To Deploy Your Django App On OVH (VPS with Nginx) + SSL certificate + Domain Name

Utility Cost Tracker for Smart Home devices with Python and Django

Creating custom template tags and filters in Django

code inside ‘’