Skip to main content

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

Project description

Flask-Mail-SendGrid
===================

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:

.. code:: bash

$ pip install flask-mail-sendgrid

or install latest version:

.. code:: bash

$ git clone https://github.com/hamano/flask-mail-sendgrid.git
$ cd flask-mail-sendgrid
$ python setup.py install

Configuring Flask-Mail-SendGrid
-------------------------------

- MAIL\_SENDGRID\_API\_KEY: API Key for SendGrid
- MAIL\_DEFAULT\_SENDER: default sender

.. code:: python

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:

.. code:: python
from flask_mail import Message

@app.route("/")
def index():
msg = Message("Hello",
sender="from@example.com",
recipients=["to@example.com"])

The message can contain a body and/or HTML:

.. code:: python

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

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

.. code:: python

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.6.tar.gz (2.6 kB view details)

Uploaded Source

File details

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

File metadata

File hashes

Hashes for Flask-Mail-SendGrid-0.1.6.tar.gz
Algorithm Hash digest
SHA256 eb386926589fd661ce3e610e0d7e404eaad73e0be568910129a442748f4e264d
MD5 ea920b91e1f72b0240f90403df87a0c0
BLAKE2b-256 3705c65b3de17e58b3471de9cda617f1b59170dfe421b8a86b1fb63466f09268

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