Send email to Django com Sendgrid

Asked

Viewed 69 times

0

I am working with Django 2.2 and need to configure Sendgrid to send some emails on the system, I found some tutorials and I am trying to follow, I did the following:

In the archive settings.py added:

EMAIL_HOST = 'smtp.sendgrid.net'
EMAIL_HOST_USER = 'leilaapsilva'
EMAIL_HOST_PASSWORD = [senha do sendgrid]
EMAIL_PORT = 587
EMAIL_USER_TLS = True

In the views.py of one of the apps:

from django.core.mail import send_mail
from django.conf import settings


send_mail('Subject here', 'Here is the message.', 'leila**@gmail.com', ['leila***@gmail.com'], fail_silently=False)

I don’t understand why the error if I didn’t change anything in urls.py. Does anyone know how to fix this or can explain me a better way to configure Sendgrid?

  • why the vote against?

  • you are forgetting the variable SENDGRID_API_KEY, look at doc theirs

  • Apparently you edited your question and removed the part that would show us which error is giving... Without this error any help would be kick. It would be better if you [Edit] your question and re-enter the error (if the error is too big you can leave only the important part)

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.