Skip to main content
Join the official 2019 Python Developers SurveyStart the survey!

Django email backend that writes messages to logger instead of sending them by SMTP.

Project description

Django EmailLog Backend

Simple email backend for Django that writes messages to logger instead of sending them to a SMTP server.

Installation is easy using ``pip`` and will install all required libraries.


Installation is easy using ``pip``

$ pip install django-emaillog-backend

or get it from source

$ git clone
$ cd django-emaillog-backend
$ python install


To ensure that all emails sent using the send_mail function of Django are sent to a log should add the following to your ```` file:

EMAIL_BACKEND = 'emaillog_backend.LoggerBackend'

You can specify the logger to which the logs will be sent adding in your ```` file

EMAIL_LOGGER_NAME = 'your_logger_name'

For example, you can create a custom logger to test sending emails as follow:

Add a custom logger in your ```` file:

'version': 1,
'disable_existing_loggers': False,
'formatters': {
'handlers': {
'loggers': {
'email_logger': {
'handlers': ['your_handler'],
'propagate': True,
'level': 'DEBUG',

In your ```` file select the email backend and set the EMAIL_LOGGER_NAME constant:

EMAIL_BACKEND = 'django-emaillog-backend.backends.LoggerBackend'

EMAIL_LOGGER_NAME = 'email_logger'

The default logger for ``django-emaillog-backend`` is the global Django logger called 'django'.

It is also possible to choose the severity level of messages sent to the logger adding the following to your ```` file:

EMAIL_LOGGER_LEVEL = logger_level

where ``EMAIL_LOGGER_LEVEL`` is an integer. We recommend using the severity levels of module logging:

logging.DEBUG (10)
logging.INFO (20)
logging.WARNING (30)
logging.ERROR (40)
logging.CRITICAL (50)

For example:

import logging

The default log level is INFO.

Project details

Release history Release notifications

This version


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