No Module Named 'Sendgrid_Backend' in Django
When Sending an Email on Heroku I Get This Error: No Module Named 'Sendgrid_Backend' I Have This Set up in Settings. Py: Email_Backend = "Sendgrid_Backend...
When sending an email on heroku I get this error:
No module named 'sendgrid_backend'
I have this set up in settings.py:
EMAIL_BACKEND = "sendgrid_backend.SendgridBackend"
SENDGRID_API_KEY = os.environ.get("SENDGRID_API_KEY")
EMAIL_PORT = 587
EMAIL_USE_TLS = True
EMAIL_HOST = 'smtp.sendgrid.net'
EMAIL_HOST_USER = 'apikey'
EMAIL_HOST_PASSWORD = os.environ.get('SENDGRID_API_KEY')
I also did install of sendgrid using pip and included it in the requirements.txt
5 Answers
I think this will help you First, install the package
pip install sendgrid-django
and then create requirements.txt, email backend should be like this
EMAIL_BACKEND = "sgbackend.SendGridBackend"
or you can also do this
pip install django-sendgrid-v5
#
EMAIL_BACKEND = 'sendgrid_backend.SendgridBackend'
SENDGRID_API_KEY = '<SENDGRID_API_KEY>'
I think you should follow this
After some tinkering around, this worked for me:
SENDGRID_API_KEY = os.environ.get("SENDGRID_API_KEY")
EMAIL_HOST = 'smtp.sendgrid.net'
EMAIL_HOST_USER = 'your sendgrid user name'
EMAIL_HOST_PASSWORD = 'your sendgrid password'
EMAIL_PORT = 587
EMAIL_USE_TLS = True
DEFAULT_FROM_EMAIL = 'your sendgrid email'
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
For my case, I just needed to switch to this:
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
The sendgrid dependency is fine, just needed a different email backend setting.
what you simply need to do is this:
EMAIL_BACKEND = "sgbackend.SendGridBackend"
and make sure you have installed sendgrid-django using:
pip install sendgrid-django
this just worked for me
You need to add
EMAIL_BACKEND = 'django.core.mail.backends.smtp.EmailBackend'
But also if you get an SMTPSenderRefused with 550, b'Unauthenticated senders not allowed' error you have to go to the SendGrid website and authenticate your sender email, aka the email from which you want to send something