Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

Adds SendGrid support to Flask applications

Project description

PyPI version Travis Build Coverage Status

Flask plugin for sending emails with SendGrid.

Provides full support for all Twilio SendGrid Web API v3 endpoints, including v3 /mail/send.

Installation

pip install flask-sendgrid

Usage

from flask_sendgrid import SendGrid
app = Flask(__name__)
app.config['SENDGRID_API_KEY'] = 'your api key'
app.config['SENDGRID_DEFAULT_FROM'] = 'admin@yourdomain.com'
mail = SendGrid(app)

# send multiple recipients; backwards compatible with Flask-Mandrill
mail.send_email(
    from_email='someone@yourdomain.com',
    to_email=[{'email': 'test1@example.com'}, {'email': 'test2@example.com'}],
    subject='Subject'
    text='Body',
)

# send single recipient; single email as string
mail.send_email(
    from_email='someone@yourdomain.com',
    to_email='test@example.com',
    subject='Subject'
    text='Body',
)

# send single recipient; single email as sendgrid.mail.helpers.Email object
mail.send_email(
    from_email='someone@yourdomain.com',
    to_email=Email('test@example.com'),
    subject='Subject'
    text='Body',
)

# send multiple recipients; list of emails as sendgrid.mail.helpers.Email object
mail.send_email(
    from_email='someone@yourdomain.com',
    to_email=[Email('test1@example.com'), Email('test2@example.com')],
    subject='Subject'
    text='Body',
)

For additional information about mail parameters: SendGrid Web API Mail

Release History

0.5.12 (2016-1-3)

  • another maintenance release

0.5.1 (2016-1-3)

  • maintenance release

0.5.0 (2016-1-2)

  • Upgrading to support SendGrid API v3

0.1.0 (2016-03-30)

  • First release.

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-SendGrid, version 0.7.1
Filename, size File type Python version Upload date Hashes
Filename, size Flask_SendGrid-0.7.1-py2-none-any.whl (4.1 kB) File type Wheel Python version py2 Upload date Hashes View hashes
Filename, size Flask_SendGrid-0.7.1-py3-none-any.whl (4.1 kB) File type Wheel Python version py3 Upload date Hashes View hashes
Filename, size Flask-SendGrid-0.7.1.tar.gz (4.1 kB) File type Source Python version None Upload date Hashes View hashes

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page