Skip to main content

A mail sending library for keg applications

Project description


Keg-Mail is a basic wrapper around Flask-Mail which gives some added support for templates.

It is not finished by any means and in some ways provides little additional benefit over Flask-Mail.


$ pip install keg-mail

Initialize Keg-Mail in you application

import flask
import keg_mail
from keg.signals import app_ready
from keg import Keg

bp = flask.blueprint('main', __name__)
mail = keg_mail.KegMail()

class App(Keg):
  use_blueprints = [bp]

Initialize the extension with the application

def init_extensions(app):
    """Init custom extensions used by this application"""


Define email content

import keg_mail

hello_world_content = keg_mail.EmailContent(
  text='Hello {name}!'
  html='<h1>Hello {name}!</h1>'

Send the email

from app import mail
import app.emails as emails
import keg_mail

def index():
          subject="Hello {name}!",

Test the email

from app import mail

def test_send_mail():
    with mail.record_messages() as outbox:
        resp = app.test_client.get('/')
        assert len(outbox) == 1
        assert outbox[0].subject == "Hello You!"
        assert outbox[0].body == "Hello You!"


0.1.0 - 2017-03-23

  • Initial Release

Project details

Release history Release notifications

Download files

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

Files for Keg-Mail, version 0.1.0
Filename, size File type Python version Upload date Hashes
Filename, size Keg_Mail-0.1.0-py2.py3-none-any.whl (6.8 kB) File type Wheel Python version py2.py3 Upload date Hashes View hashes
Filename, size Keg-Mail-0.1.0.tar.gz (5.4 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