title: How to send with Sendgrid a reset password email from a Django app deployed in Heroku?
body: <p>I have been struggling for a while in trying to correctly setup the <code>settings.py</code> to send an email for password reset.This is my current configuration:</p>
  
  <pre><code>SENDGRID_API_KEY = os.environ["SENDGRID_API_KEY"]
  SENDGRID_PASSWORD= os.environ["SENDGRID_PASSWORD"]
  SENDGRID_USERNAME= os.environ["SENDGRID_USERNAME"]
  
  EMAIL_HOST = 'smtp.sendgrid.net'
  EMAIL_HOST_USER = os.environ['SENDGRID_USERNAME']
  #EMAIL_HOST_USER = 'apikey'
  EMAIL_HOST_PASSWORD = os.environ["SENDGRID_PASSWORD"]
  EMAIL_PORT = 587
  EMAIL_USE_TLS = True
  DEFAULT_FROM_EMAIL = os.environ["DEFAULT_FROM_EMAIL"]
  
  #SENDGRID_SANDBOX_MODE_IN_DEBUG = False
  EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
  </code></pre>
  
  <p>I have come across the following posts that are related to my problem but none of them have worked:</p>
  
  <ol>
  <li><a href="https://stackoverflow.com/questions/53982067/sending-smtp-email-with-django-and-sendgrid-on-heroku">Sending SMTP email with Django and Sendgrid on Heroku</a> </li>
  <li><a href="https://stackoverflow.com/questions/60014049/no-module-named-sendgrid-backend-in-django">No module named &#39;sendgrid_backend&#39; in django</a></li>
  <li><a href="https://stackoverflow.com/questions/50316675/send-email-with-sendgrid-in-django">Send email with Sendgrid in Django</a></li>
  <li><a href="https://stackoverflow.com/questions/9723494/setting-up-email-with-sendgrid-in-heroku-for-a-django-app">Setting up email with Sendgrid in Heroku for a Django App</a></li>
  <li><a href="https://stackoverflow.com/questions/10790603/heroku-django-and-sendgrid-emails-not-sending">Heroku, Django, and Sendgrid - emails not sending?</a></li>
  </ol>
  
  <p>When I used the <code>EMAIL_BACKEND = "sendgrid_backend.SendgridBackend"</code>(after I installed the <code>django-sendgrid-v5</code> library) I didn't receive any error but I didn't receive any email :'( and in the previous cases I encountered the following error <code>SMTPServerDisconnected at /password-reset/</code> and <code>Connection unexpectedly closed</code>. Any help, suggestion, comment, crazy idea is really appreciated because I have spent several hours in this problem that will be a milestone in my project.</p>
  
  <p>Thank you everyone :)</p>