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.

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

Development

Install the dev-requirements with:

pip install -r requirements/test.txt

This’ll give you ipython for a prettier shell-experience, but more importantly it’ll install pre-commit. Pre-commit will check for syntax errors and merge conflicts, and fix trailing whitespaces and mixed line-endings for you.

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.8.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.8.0.tar.gz (19.8 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.8.0-py3-none-any.whl (7.4 kB view details)

Uploaded Python 3

File details

Details for the file django_mailrobot-0.8.0.tar.gz.

File metadata

  • Download URL: django_mailrobot-0.8.0.tar.gz
  • Upload date:
  • Size: 19.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.10.12

File hashes

Hashes for django_mailrobot-0.8.0.tar.gz
Algorithm Hash digest
SHA256 4aeba9308188a8f2d03db495ba856354765d2c740d829b28d9d9d35002aa9e96
MD5 674e86775390b238803d6dcdf2a05292
BLAKE2b-256 f31b0996c131fb1c50fc5e152124ba14cd4b12a3f0aaf7e76f741bde576646b1

See more details on using hashes here.

File details

Details for the file django_mailrobot-0.8.0-py3-none-any.whl.

File metadata

File hashes

Hashes for django_mailrobot-0.8.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0c5dd473d38a96a0c6e95438c4a46e29115f1731e536bacf614589caedaab137
MD5 9b421d61b152369fa2c637fae7e25a69
BLAKE2b-256 846bbedeea0131b544af88043e6da77559bfef3a8479b787b10c6b0cc623e7ef

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