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
Install the library, for instance with pip:
pip install django-mailrobot
Add the library to your INSTALLED_APPS of an exiting project:
INSTALLED_APPS += ['mailrobot']
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 <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:
- Select it
- Choose “Clone selected mails” in the action list
- 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 |
---|
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Filename, size | File type | Python version | Upload date | Hashes |
---|---|---|---|---|
Filename, size django_mailrobot-0.6.0-py2.py3-none-any.whl (9.8 kB) | File type Wheel | Python version py2.py3 | Upload date | Hashes View |
Filename, size django-mailrobot-0.6.0.tar.gz (6.8 kB) | File type Source | Python version None | Upload date | Hashes View |
Hashes for django_mailrobot-0.6.0-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6fad6656480c2d77a34405285f3529da602f20d1849997785107ce539cb855b0 |
|
MD5 | d890594e25a66e9af1f7825399040bf5 |
|
BLAKE2-256 | 11f0b755b62d0aa47b24dc7aaf102f1a83628db31bd6e46007fda95eb7affe31 |