Skip to main content

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 3.2 and 6.0, 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.2

Metadata

Release files for django-mailrobot 0.8.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-mailrobot 0.8.2
File Size Uploaded
django_mailrobot-0.8.2.tar.gz 20.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for django-mailrobot 0.8.2
File Interpreter ABI Platform
django_mailrobot-0.8.2-py3-none-any.whl Python 3 none any Details

Total release size: 27.6 kB

Release files / django_mailrobot-0.8.2.tar.gz

Download URL django_mailrobot-0.8.2.tar.gz
Size 20.1 kB
Tags Source
SHA-256 checksum
How to use checksums
f62bda49829cf76f24a24609e7a0e73c4b6a5e18673e1da5b878ebf0c04fc222
BLAKE2b-256 checksum
How to use checksums
6e465fed75043e4ca149f6d2a52b67d12d1a0e91a81b3fdeab26f54e52b91506
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.3

Release files / django_mailrobot-0.8.2-py3-none-any.whl

Download URL django_mailrobot-0.8.2-py3-none-any.whl
Size 7.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8246225886b49de2ef6d96dc01290839c6def9e33869fb0fe22d0d596800ce72
BLAKE2b-256 checksum
How to use checksums
d6c5ec42670e7865c545b4b6728fef246c07a98f86b9b54a4860ddff549a4632
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.12.3

Release history Release notifications | RSS feed

This release

0.8.2 This release

2 release files

0.8.1

2 release files

0.8.0

2 release files

0.7.0

1 release file

0.6.0

2 release files

0.5.3

2 release files

0.5.1

2 release files

0.5.0

0.4.1

2 release files

0.4.0

2 release files

0.3.2

1 release file

0.3.1

1 release file

0.3

1 release file

0.2

1 release file

0.1

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page