There is more detailed information about sending email over SMTP with Django on the Django project website.
First start by adding the following to settings.py:
SENDGRID_API_KEY = os.getenv('SENDGRID_API_KEY') EMAIL_HOST = 'smtp.sendgrid.net' EMAIL_HOST_USER = 'apikey' # this is exactly the value 'apikey' EMAIL_HOST_PASSWORD = SENDGRID_API_KEY EMAIL_PORT = 587 EMAIL_USE_TLS = True
Then to send email you can do the following: Inside yourapp.views.py
from django.core.mail import send_mail send_mail('Subject here', 'Here is the message.', 'email@example.com', ['firstname.lastname@example.org'], fail_silently=False)
Let us know how we’re doing! Please rate this page:
Please note, we cannot resolve account and login issues reported on GitHub. Contact support for account assistance.
Thanks for helping us improve our docs!