Skip to main content

Django app for managing multiple mass-mailing lists with both plaintext as well as HTML templates (and TinyMCE editor for HTML messages), images and a smart queueing system all right from the admin interface.

Project description

Newsletter application for the Django web framework.

What is it?

Django app for managing multiple mass-mailing lists with both plaintext as well as HTML templates with rich text widget integration, images and a smart queueing system all right from the admin interface.


We are currently using this package in several large to medium scale production environments, but it should be considered a permanent work in progress.


Most if not all strings are available in Dutch, German, French, Farsi, Russian and English. Contributions to translations are welcome through Transifex.


Currently, django-newsletter is being tested to run on Python 2.6, 2.7 and the latest Django 1.4 and 1.5 releases. Apart from tests it should be compatible with Python 2.5 as well.


Please refer to requirements.txt for an updated list of required packages.


  1. Get it from the Cheese Shop:

    pip install django-newsletter

    Or get the latest & greatest from Github and link it to your application tree:

    pip install -e git://

    (In either case it is recommended that you use VirtualEnv in order to keep your Python environment somewhat clean.)

  2. Add newsletter and to INSTALLED_APPS in and make sure that your favourite rich text widget (optional), some Django contrib dependencies, sorl-thumbnail and django-extensions (the latter is used for the submission jobs) are there as well:

        # Imperavi (or tinymce) rich text editor is optional
        # 'imperavi',
  3. Disable email confirmation for subscribe, unsubscribe and update actions for subscriptions.

    By default subscribe, unsubscribe and update requests made by a user who is not logged in need to be confirmed by clicking on an activation link in an email. If you want all requested actions to be performed without email confirmation, add following line to


    For more granular control the NEWSLETTER_CONFIRM_EMAIL setting can be overridden for each of subscribe, unsubscribe and update actions, by adding NEWSLETTER_CONFIRM_EMAIL_SUBSCRIBE and/or NEWSLETTER_CONFIRM_EMAIL_UNSUBSCRIBE and/or NEWSLETTER_CONFIRM_EMAIL_UPDATE set to True or False.

  4. Install and configure your preferred rich text widget (optional).

    Known to work are django-imperavi as well as for django-tinymce. Be sure to follow installation instructions for respective widgets. After installation, the widgets can be selected as follows:

    # Using django-imperavi
    NEWSLETTER_RICHTEXT_WIDGET = "imperavi.widget.ImperaviWidget"
    # Using django-tinymce
    NEWSLETTER_RICHTEXT_WIDGET = "tinymce.widgets.TinyMCE"

    If not set, django-newsletter will fall back to Django’s default TextField widget.

  5. Import subscription, unsubscription and archive URL’s somewhere in your

    urlpatterns = patterns('',
        (r'^newsletter/', include('newsletter.urls')),
  6. Enable Django’s staticfiles app so the admin icons, CSS and JavaScript will be available where we expect it.

  7. Create required data structure:

    ./ syncdb
  8. Change the default contact email listed in templates/newsletter/subscription_subscribe.html and templates/newsletter/subscription_update.html.

  9. (Optionally) Create message template overrides for specific newsletters in templates/newsletter/message/<newsletter_slug>/<message_type>[_subject].<html|txt> where <message_type> can be one from subscribe, unsubscribe, message or update.

  10. (Optionally) Run the tests to see if it all works:

    ./ test

    If it does: that’s a good sign. You’ll probably have yourself a working configuration!

  11. Add jobs for sending out mail queues to crontab:

    @hourly /path/to/my/project/ runjobs hourly
    @daily /path/to/my/project/ runjobs daily
    @weekly /path/to/my/project/ runjobs weekly
    @monthly /path/to/my/project/ runjobs monthly


  1. Start the development server: ./ runserver
  2. Navigate to /admin/ and: behold!
  3. Put a submission in the queue.
  4. Submit your message with ./ runjob submit
  5. For a proper understanding, please take a look at the model graph.


To get started, we recommend copying the existing ‘stub’-templates from the module directory to your project’s templates dir:

cp -rv `python -c 'import newsletter; from os import path; print path.dirname(newsletter.__file__)'`/templates/newsletter <project_dir>/templates/

Web view templates

Newsletter list view, showing all newsletters marked as public and allowing authenticated Django users to (un)subscribe directly.
Newsletter detail view, linking to subscribe, update, unsubscribe and archive views for a particular newsletter.
Archive; list of public submissions for a particular newsletter.
Subscribe form for unauthenticated users.
Confirmation of subscription request.
Activation form for (un)subscriptions or updates of unauthenticated users.
Confirmation of activation of subscription.
Confirmation of activation of unsubscription.
Confirmation of activation of update.
Subcribe form for authenticated users.
Unsubscribe form for unauthenticated users.
Confirmation of unsubscription request.
Unsubscribe form for authenticated users.
Update form for unauthenticated users.
Confirmation of update request.

Email templates

Email templates can be specified per newsletter in message/<newsletter_slug>. If no newsletter-specific templates are found, the defaults in the message folder are used.

When a newsletter is configured to send HTML-messages, the HTML and txt are both used to create a multipart message. When the use of HTML is not configured only the text templates are used.

The following templates can be defined:

Template for rendering a messages with the following context available:
  • subscription: Subscription containing name and email of recipient.
  • site: Current site object.
  • submission: Current submission.
  • message: Current message.
  • newsletter: Current newsletter.
  • date: Publication date of submission.
  • STATIC_URL: Django’s STATIC_URL setting.
  • MEDIA_URL: Django’s MEDIA_URL setting.
Template for the subject of an email newsletter. Context is the same as with messages.
Template with confirmation link for subscription.
Subject template with confirmation link for subscription.
Template with confirmation link for unsubscription.
Subject template with confirmation link for unsubscription.
Template with confirmation link for updating subscriptions.unsubscription.
Subject template with confirmation link for updating subscriptions.unsubscription.

Unit tests

Fairly extensive tests are available for internal frameworks, web (un)subscription and mail sending. Sending a newsletter to large groups of recipients (+10k) has been confirmed to work in multiple production environments. Tests for pull req’s and the master branch are automatically run through Travis CI.


0.5: Message templates in files

As of 0.5 message templates are living in the filesystem like normal files instead of resorting in the EmailTemplate in the database. In most cases, South should take care of writing your existing templates to disk and deleting the database models.

0.4: South migrations

Since 5f79f40, the app makes use of South for schema migrations. As of this version, using South with django-newsletter is the official recommendation and installing it is easy.

When upgrading from a pre-South version of newsletter to a current release (in a project for which South has been enabled), you might have to fake the initial migration as the DB tables already exist. This can be done by running the following command:

./ migrate newsletter 0001 --fake


If you find any bugs or have feature request for django-newsletter, don’t hesitate to open up an issue on GitHub (but please make sure your issue hasn’t been noticed before, finding duplicates is a waste of time). When modifying or adding features to django-newsletter in a fork, be sure to let me know what you’re building and how you’re building it. That way we can coordinate whether, when and how it will end up in the main fork and (eventually) an official release.

In general: thanks for the support, feedback, patches and code that’s been flowing in over the years! Django has a truly great community. <3


Donations are welcome in Bitcoin or Paypal through Properster. For Bitcoin, the link/QRCode below should suffice. If you donate, be sure to fill in the note. I love to hear what people are using it for!


This application is released under the GNU Affero General Public License version 3.



  • Added proxy for app-specific settings.
  • Optional skipping of email confirmation in views (CONFIRM_EMAIL_<ACTION>).
  • Russian translation (contributed by ak3n).
  • Added explicit HTML toogle to Newsletter model.
  • Fix JavaScript submit link on “Add submission”, ported to use jQuery.
  • Replacement of remaining function based views with class based equivalents.
  • Move message templates from database to files.

0.4.1 (15-04-2013)

  • Started keeping a decent history file. (Finally…)
  • Support Django 1.5; make use of class based generic views
  • Drop Django 1.3 and Python 2.5 support.
  • 100% test coverage for views
  • Farsi translations (contributed by rohamn)
  • French translations (contributed by smalter)
  • Admin actions for subscribing/unsubscribing (contributed by jnns)
  • Introduced django-webtest for some tests
  • Exempt previews from XFrame protection (fixes #54)

0.4 (20-11-2012)

  • Major code cleanup; PEP8, imports, restructuring, removal of legacy code
  • Improved testing throgh Travis and better test coverage
  • South migrations
  • Added German translation (contributed by jnns)
  • WYSIWYG editor is now optional and pluggable, Imperavi and TinyMCE supported
  • Timezone-aware date-times when Django 1.4 is used
  • Ue of Django 1.3’s messages framework
  • Many small bugfixes (see GitHub issues)
  • Drop support for Django 1.2
  • Automatic detection of charset, encoding and dialect for CSV import
  • Much cleaner log messages with proper message substitution
  • Use Django’s staticfiles contrib for static assets in admin interface
  • Use surlex for more readable URL templates
  • Use sorl-thumbnail for article images and default templates

Project details

Release history Release notifications

History Node


History Node


History Node


History Node


History Node


This version
History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


History Node


Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
django-newsletter-0.5.tar.gz (207.9 kB) Copy SHA256 hash SHA256 Source None Oct 3, 2013

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page