django-mailrobot 0.4.1

Stores and sends canned email responses.

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.1

Author

kaleissin

Pip

django-mailrobot==0.4.1

Classifiers

  • Environment :: Web Environment
  • Framework :: Django
  • Intended Audience :: Developers
  • License :: OSI Approved :: MIT License
  • Operating System :: OS Independent
  • Programming Language :: Python
  • Development Status :: 4 - Beta
  • Topic :: Software Development :: Libraries :: Python Modules
  • Topic :: Software Development :: Libraries :: Application Frameworks
File Type Python Version Uploaded On Downloads
django_mailrobot-0.4.1-py2.py3-none-any.whl Wheel py2.py3 Jan. 6, 2015 758
django-mailrobot-0.4.1.tar.gz Source Jan. 6, 2015 758
Version Release Date
0.4.1 Jan. 6, 2015
0.4.0 Jan. 6, 2015
0.3.2 Dec. 5, 2013
0.3.1 Dec. 2, 2013
0.3 Nov. 26, 2013
0.2 Nov. 26, 2013
0.1 Nov. 21, 2013
Date Package Version Action
Aug. 26, 2015, 12:16 a.m. django-mailrobot 0.4.0 Release Created
Aug. 26, 2015, 12:16 a.m. django-mailrobot 0.4.1 Release Created
Aug. 26, 2015, 12:16 a.m. django-mailrobot 0.1 Release Created
Aug. 26, 2015, 12:16 a.m. django-mailrobot 0.3.1 Release Created
Aug. 26, 2015, 12:16 a.m. django-mailrobot 0.3 Release Created
Aug. 26, 2015, 12:16 a.m. django-mailrobot 0.3.2 Release Created
Aug. 26, 2015, 12:16 a.m. django-mailrobot 0.2 Release Created
Aug. 26, 2015, 12:16 a.m. django-mailrobot Package Created