Sending emails using sendgrid on heroku for a Django App

wget -O- https://toolbelt.heroku.com/install-ubuntu.sh | sh
$ heroku --version
heroku-toolbelt/3.43.3 (x86_64-linux) ruby/1.9.3
$ which heroku
/usr/local/heroku/bin/heroku
$ heroku login
Enter your Heroku credentials.
Email: user@heroku.com
Password:
$ heroku addons:create sendgrid:starter
$ heroku config:get SENDGRID_USERNAMEuser@heroku.com$ heroku config:get SENDGRID_PASSWORDpassword
import sendgridsg = sendgrid.SendGridClient(YOUR_SENDGRID_API_KEY')
message = sendgrid.Mail()
message.add_to('To_Email')
message.set_from('User_Name')
message.set_subject('Email_Subject')
message.set_html('Body')
sg.send(message)

The article was originally published at MicroPyramid blog

--

--

--

Python, Django, Android and IOS, reactjs, react-native, AWS, Salesforce consulting & development company

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

Disputes Among Contractors

disputes among contractors

Implementing Domain-Driven Design for Microservice Architecture

TWiGCP — “Welcoming Dataform, Dataproc Hub, and Cloud Run min-instances”

Alibaba Dragonfly DCOS Case Study: China Mobile (Zhejiang Branch)

Laugh Tracks a Turing Project

Automate your Redshift DWH Ingestion from S3

CS371P Fall 2019: Final Entry

Common Enumerables in Ruby

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
MicroPyramid

MicroPyramid

Python, Django, Android and IOS, reactjs, react-native, AWS, Salesforce consulting & development company

More from Medium

Build a simple To-Do List App with Django

Blacklisting JWT access tokens in Django

Extend Django Poll App with HTMX and Alpine.js

How to create desktop notifications in Django?