Skip to main content
Python Software Foundation 20th Year Anniversary Fundraiser  Donate today!

Flask extension for sendgrid. It has same interface with Flask-Mail.

Project description

Flask extension for sendgrid. It has same interface with Flask-Mail.

Flask-Mail-SendGrid is friendly with another extention such as Flask-Security.

Installing Flask-Mail-SendGrid

Install with pypi:

$ pip install flask-mail-sendgrid

or install latest version:

$ git clone
$ cd flask-mail-sendgrid
$ python install

Configuring Flask-Mail-SendGrid

  • MAIL_DEFAULT_SENDER: default sender
from flask import Flask
from flask_mail_sendgrid import MailSendGrid

app = Flask(__name__)
mail = MailSendGrid(app)

Sending messages

To send a message first create a Message instance:

from flask_mail import Message

def index():
    msg = Message("Hello",

The message can contain a body and/or HTML:

msg.body = "testing"
msg.html = "<b>testing</b>"

Or, if you are using Templates in Sendgrid, you may specify a Template ID and Data:

msg.template_id = 'my-template-id'
msg.dynamic_template_data = {'first_name': 'John', 'last_name': 'Doe'}

Finally, to send the message, you use the Mail instance configured with your Flask application:


Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for Flask-Mail-SendGrid, version 0.3
Filename, size File type Python version Upload date Hashes
Filename, size Flask-Mail-SendGrid-0.3.tar.gz (3.0 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page