Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/vitalk/flask-mailer
A Flask extension for sending email messages
https://github.com/vitalk/flask-mailer
flask mail
Last synced: 27 days ago
JSON representation
A Flask extension for sending email messages
- Host: GitHub
- URL: https://github.com/vitalk/flask-mailer
- Owner: vitalk
- Created: 2012-11-09T19:43:25.000Z (almost 12 years ago)
- Default Branch: master
- Last Pushed: 2015-05-14T20:27:20.000Z (over 9 years ago)
- Last Synced: 2024-10-08T16:53:54.605Z (30 days ago)
- Topics: flask, mail
- Language: Python
- Homepage: https://pypi.python.org/pypi/Flask-Mailer
- Size: 574 KB
- Stars: 5
- Watchers: 3
- Forks: 0
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGES.md
Awesome Lists containing this project
README
Flask-Mailer
============A Flask extension for sending email messages. Includes different mailer
backends for different purposes:- Dummy backend (useful for tests)
- SMTP backend (SMTP lib wrapper)Installation
------------Install from PyPi via `pip`:
```sh
pip install Flask-Mailer
```Configuration
-------------| Option | Description |
| ----------------------- | ---------------------------------------------------------------------- |
| `MAILER_BACKEND` | Path to mailer backend, e.g. `flask_mailer.backends.smpt.SMTPMailer` |
| `MAILER_TESTING` | Enable dummy backend for testing |
| `MAILER_HOST` | Hostname for SMTP backend, e.g. `localhost` |
| `MAILER_PORT` | Port for SMTP backend, e.g. `25` |
| `MAILER_USERNAME` | Username for SMTP backend |
| `MAILER_PASSWORD` | Password for SMTP backend |
| `MAILER_DEFAULT_SENDER` | Default mail sender, e.g. `webmaster` |Usage
-----```python
from flask import Flask
from flask_mailer import Mailer, Emailapp = Flask(__name__)
smtp = Mailer(app)mail = Email(
subject='hi, there',
text='awesome message',
to=['[email protected]', '[email protected]'],
from_addr='[email protected]'
)
smtp.send(mail)
```Testing
-------Setting to your app `testing` flag automatically enable the dummy mailer
backend or you can manually set `MAILER_TESTING` to `True`. On dummy mailer
all mails on send just append to outbox list:```python
smtp.send(mail)assert len(smtp.outbox) == 1
assert smtp.outbox == [mail,]
```Thanks
------The extension inspired and partially reuse the code of the some awesome
projects, such as:- [Flask-Mail](https://github.com/mattupstate/flask-mail)
- [Django](https://github.com/django/django)
- [Solace](https://github.com/Plurk/Solace)
- [reddit](https://github.com/reddit/reddit)Special thanks to their authors and contributors.
License
-------Licensed under the BSD license.