Giter Site home page Giter Site logo

barseghyanartur / django-email-bandit Goto Github PK

View Code? Open in Web Editor NEW

This project forked from caktus/django-email-bandit

0.0 1.0 0.0 112 KB

A Django email backend for hijacking email sending in a test environment.

License: BSD 3-Clause "New" or "Revised" License

Python 99.18% Shell 0.82%

django-email-bandit's Introduction

django-email-bandit

Build Status

master:Build Status
develop:Build Status

A Django email backend for hijacking email sending in a staging/test environment. It extends the default SMTP backend to intercept outgoing emails and instead send them to a single email address that you specify. It does not intercept emails going to the site admins (as defined by the ADMINS setting) so it will not interfere with 500 error emails.

You can also configure the hijacked emails to be logged through standard Python logging. Mixin classes are provided to use the same hijack logic for any existing email backend such as django-ses.

Requirements

  • Python 3
  • Django >= 2.2 (supported versions)

Installation

To install django-email-bandit via pip:

pip install django-email-bandit

Add django-email-bandit to your installed apps:

INSTALLED_APPS = (
    ...
    'bandit',
    ...
)

For your test environment you should enable the backend:

EMAIL_BACKEND = 'bandit.backends.smtp.HijackSMTPBackend'

and set the email which will receive all of the emails:

BANDIT_EMAIL = '[email protected]'

or even multiple addresses:

BANDIT_EMAIL = ['[email protected]', '[email protected]']

It's also possible to whitelist certain email addresses and domains:

BANDIT_WHITELIST = [
    '[email protected]',  # Just this specific email address
    'example.net'   # All email addresses @example.net
]

Documentation

Full project documentation is on Read the Docs.

Maintainer Information

We use Github Actions to lint (using pre-commit, black, isort, and flake8), test (using tox and tox-gh-actions), calculate coverage (using coverage), and build documentation (using sphinx).

We have a local script to do these actions locally, named maintain.sh:

$ ./maintain.sh

A Github Action workflow also builds and pushes a new package to PyPI whenever a new Release is created in Github. This uses a project-specific PyPI token, as described in the PyPI documentation here. That token has been saved in the PYPI_PASSWORD settings for this repo, but has not been saved anywhere else so if it is needed for any reason, the current one should be deleted and a new one generated.

As always, be sure to bump the version in bandit/__init__.py before creating a Release, so that the proper version gets pushed to PyPI.

Questions or Issues?

If you have questions, issues or requests for improvements please let us know on Github.

Development sponsored by Caktus Consulting Group, LLC.

django-email-bandit's People

Contributors

153957 avatar alvinchow86 avatar dpoirier avatar gavinwahl avatar ironfroggy avatar jaap3 avatar kirschnj avatar mlavin avatar petrdlouhy avatar tobiasmcnulty avatar tonysyu avatar vkurup avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.