Skip to content

Instantly share code, notes, and snippets.

@agusmakmun
Last active July 8, 2018 04:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save agusmakmun/598e3b4fb1186e702fe93128e9cea2d3 to your computer and use it in GitHub Desktop.
Save agusmakmun/598e3b4fb1186e702fe93128e9cea2d3 to your computer and use it in GitHub Desktop.

This email configuration specific for Gmail and Hosting

1. TLS Configuration for port 587

  1. Unlock Captha: https://accounts.google.com/DisplayUnlockCaptcha
  2. Change to active: https://www.google.com/settings/security/lesssecureapps
EMAIL_PORT = 587
EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER = 'your-mail@gmail.com'
EMAIL_HOST_PASSWORD = 'your-password'
DEFAULT_FROM_EMAIL = EMAIL_HOST_USER
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
FILE_UPLOAD_MAX_MEMORY_SIZE = 35000000

2. SSL Configuration for port 465

  1. Unlock Captha: https://accounts.google.com/DisplayUnlockCaptcha
  2. Change to active: https://www.google.com/settings/security/lesssecureapps
  3. Go to the 2-Step Verification: https://myaccount.google.com/signinoptions/two-step-verification/enroll-welcome
  4. Create app password: https://security.google.com/settings/security/apppasswords
  5. Use that password into 'EMAIL_HOST_PASSWORD'
EMAIL_PORT = 465
EMAIL_USE_SSL = True
EMAIL_HOST = 'smtp.gmail.com'
EMAIL_HOST_USER = 'myemmail@gmail.com'
EMAIL_HOST_PASSWORD = 'use-apppasswords'
DEFAULT_FROM_EMAIL = EMAIL_HOST_USER
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
EMAIL_SSL_KEYFILE = '/home/username/ssl/keys/keyname.key'
EMAIL_SSL_CERTFILE = '/home/username/ssl/certs/certname.crt'
FILE_UPLOAD_MAX_MEMORY_SIZE = 35000000
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment