Skip to main content

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 https://github.com/hamano/flask-mail-sendgrid.git
$ cd flask-mail-sendgrid
$ python setup.py install

Configuring Flask-Mail-SendGrid

  • SENDGRID_API_KEY: API Key for SendGrid

  • MAIL_DEFAULT_SENDER: default sender

Usage

from flask import Flask
from flask_mail_sendgrid import MailSendGrid
from flask_mail import Message

app = Flask(__name__)
mail = MailSendGrid(app)
msg = Message("Hello",
              sender="from@example.com",
              recipients=["to@example.com"])

The message can contain a body and/or HTML:

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

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

mail.send(msg)

Project details


Download files

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

Source Distribution

Flask-Mail-SendGrid-0.1.4.tar.gz (2.5 kB view details)

Uploaded Source

File details

Details for the file Flask-Mail-SendGrid-0.1.4.tar.gz.

File metadata

File hashes

Hashes for Flask-Mail-SendGrid-0.1.4.tar.gz
Algorithm Hash digest
SHA256 4527dfe8664cb92593496701486c938340f957d7d915aa80f5df7f6823897f99
MD5 0054a71c51188596125e8e10941521f9
BLAKE2b-256 546fb5aee86245ed9d4cecaec034bdf862e0fbc40a62b129ea52175a68068f1c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page