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’



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