Skip to content

UNINETTSigma2/django-mailrobot

This branch is 1 commit ahead of, 9 commits behind kaleissin/django-mailrobot:master.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

author
Andreas Bach
Jun 28, 2021
059b1be · Jun 28, 2021
Jan 6, 2015
Jun 28, 2021
Jun 28, 2021
Aug 4, 2019
Oct 9, 2018
Aug 6, 2019
Nov 22, 2013
Nov 22, 2013
Aug 4, 2019
Oct 9, 2018
Oct 9, 2018
Aug 4, 2019
Nov 25, 2013
Aug 4, 2019
Jan 5, 2015
Jun 28, 2021
Jun 28, 2021

Repository files navigation

django-mailrobot

Stores and sends canned email responses.

Ever had to change the signature or add a recipient to N hardcoded emails spread all throughout your code? Hardcode no more! Use mailrobot instead.

Depends on Django, with a version between 1.11 and 2.2, inclusive.

Installation

  1. Install the library, for instance with pip:

    pip install django-mailrobot
    
  2. Add the library to your INSTALLED_APPS of an exiting project:

    INSTALLED_APPS += ['mailrobot']
    
  3. Add the tables to the existing project.

    $ ./manage.py migrate
    

Demo

Copy the entire django-mailrobot directory somewhere, set up and enter a virtualenv, then provided you are on some Un*x:

make demo

This'll create a demo-user "demo" with the password "demo".

The demo should now be running on http://127.0.0.1/

Tests

To run the tests, first install the testing-requirements:

pip install -r requirements/test.txt

then run the tests with:

make test APP=mailrobot

Usage

Add mails and addresses through the django admin.

In code

Fetch a mail-template:

template = Mail.objects.get(name='hello-world').

Fill it:

mail = template.make_message(
    sender='Yep <[email protected]'>,
    recipients=('[email protected]', u'Blåbærsyltetøy <[email protected]>'),
    context={'world': 'Mailrobot'}
)

Have a look:

print mail.message

Send it:

mail.send()

Niceties

In case you need to send an email somewhere else for testing/debugging, clone an existing email in the admin:

  1. Select it
  2. Choose "Clone selected mails" in the action list
  3. Hit "Go"

The clone will share everything with its original except the name, which will be suffixed with a timestamp.

Edit the name of the clone to what you need, change recipients, CCs, BCCs. Then, where you send the mail from, choose the clone if settings.DEBUG is True.

Version:0.6.0

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Python 88.1%
  • Makefile 11.9%