Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: c2b99ab60b
Fetching contributors…

Cannot retrieve contributors at this time

25 lines (20 sloc) 0.772 kb
Backend for test environment.
import sys
from tornado_utils import send_mail as mail # ugliest hack known to man
from .base import BaseEmailBackend
class EmailBackend(BaseEmailBackend):
"""A email backend for use during test sessions.
The test connection stores email messages in a dummy outbox,
rather than sending them out on the wire.
The dummy outbox is accessible through the outbox instance attribute.
def __init__(self, *args, **kwargs):
super(EmailBackend, self).__init__(*args, **kwargs)
if not hasattr(mail, 'outbox'):
mail.outbox = []
def send_messages(self, messages):
"""Redirect messages to the dummy outbox"""
return len(messages)
Jump to Line
Something went wrong with that request. Please try again.