Skip to main content

Stores and sends canned email responses.

Project description

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.

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.

    Prior to django 1.7:

    $ ./manage.py syncdb

    With South:

    $ ./manage.py schemamigration --initial mailrobot
    $ ./manage.py migrate mailrobot

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 ask you to make an admin user. Do so.

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 <overridden-from@example.com'>,
    recipients=('extra1@example.com', u'Blåbærsyltetøy <extra2@example.com>'),
    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.4.0

Project details


Download files

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

Source Distribution

django-mailrobot-0.4.0.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_mailrobot-0.4.0-py2.py3-none-any.whl (8.8 kB view details)

Uploaded Python 2Python 3

File details

Details for the file django-mailrobot-0.4.0.tar.gz.

File metadata

File hashes

Hashes for django-mailrobot-0.4.0.tar.gz
Algorithm Hash digest
SHA256 0ce88afe17069045031c72a6fd265dee252bccecaa57fb12d83864bb8262e17f
MD5 d1815a50e2a9c3a860bcca24601995b5
BLAKE2b-256 b18a932fa8da3a1d415c8a286d6be481791503f40cf050c3b3789b67576ffa00

See more details on using hashes here.

File details

Details for the file django_mailrobot-0.4.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for django_mailrobot-0.4.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 abbeb3be29bd1352f60ff2860b5b955826f95ef9482e727da4204d15a92dbfb6
MD5 978520d1264e253390b8429ceac3a2c0
BLAKE2b-256 6d4fbc9f371538c21da43ec2469f6ef0aa822f399f0e5b1ab7741ae30bc700ae

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page