Flask extension for Red Mail
Flask Red Mail is a Flask extension for Red Mail. Red Mail is a powerful email sender library capable of including attachments from various formats, embedding images, parametrization with Jinja etc. This library harness the power of Red Mail in order to make it trivial to:
- Send verification emails to users
- Create email based forgot password functionality
- Create Flask based email news letters
- Handle other needs for sending emails from a web application
Links:
- Flask-Redmail's source code
- Flask-Redmail's documentation
- Flask-Redmail's releases (PyPI)
- Red Mail's source code
- Red Mail's documentation
- Red Mail's releases (PyPI)
Install the extension from PyPI:
pip install flask-redmail
Create a simple Flask application:
import flask
from flask_redmail import RedMail
app = flask.Flask(__name__)
email = RedMail(app)
# Configure
app.config["EMAIL_HOST"] = "localhost"
app.config["EMAIL_PORT"] = 0
# Optional
app.config["EMAIL_USERNAME"] = "me@example.com"
app.config["EMAIL_PASSWORD"] = "<PASSWORD>"
app.config["EMAIL_SENDER"] = "no-reply@example.com"
Use the extension:
@app.route("/send")
def send_email():
email.send(
subject="An example",
receivers=["you@example.com"],
html="<h1>An example email.</h1>"
)
- Mikael Koli - Miksus - koli.mikael@gmail.com