A Django app for sending newsletter by email to a contact list.
The problematic was :
How to couple a contact base to a mailing list and sending newsletters throught Django ?
Imagine that we have an application containing some kind of profiles or something like the django.contrib.auth and you want to send newsletters to them and tracking the activity.
This package is a fork of of emencia-django-newsletter with django 1.6 compatibility and other customizations
- DBMS considerations
- HOWTO use TinyMCE for editing the newsletters
- HOWTO couple your profile application with emencia.django.newsletter
- Database Representation
More than a long speech, here the list of the main features :
- Coupling capacities with another django model.
- Variables can be used in the newsletter’s templates.
- Mailing list managements (merging, importing…).
- Import/Export of the contact in VCard 3.0.
- Configurable SMTP servers with flow limit management.
- Working groups.
- Can send newsletter previews.
- Subscriptions and unsubscriptions to mailing list.
- Attachments in newsletters.
- Unique urls for an user.
- Tracking statistics.
At the level of the application architecture, we can see 2 originalities who need to be explained.
The content types application is used to link any Contact model instance to another model instance. This allow you to create different kinds of contact linked to differents application, and retrieve the association at anytime.
This is particulary usefull with the templates variables if certain informations are located in the model instance linked.
The emencia.django.newsletter application will never send the newsletters registered in the site until you launch the send_newsletter command.
$ python manage.py send_newsletter
This command will launch the newsletters who need to be launched accordingly to the credits of the SMTP server of the newsletter. That’s mean that not all newsletters will be expedied at the end of the command because if you use a public SMTP server you can be banished temporarly if you reach the sending limit. To avoid banishment all the newsletters are not sended in the same time and immediately.
So it is recommanded to create a cronjob for launching this command every hours for example.
Make sure to install these packages prior to installation :
- Django >= 1.2
The package below is optionnal but handy for rendering a webpage in your newsletter.
You could retrieve the last sources from http://github.com/Fantomas42/emencia-django-newsletter and running the installation script
$ python setup.py install
or use pip
$ pip install -e git://github.com/Fantomas42/emencia-django-newsletter.git#egg=emencia.django.newsletter
For the latest stable version use easy_install
$ easy_install emencia.django.newsletter
Then register emencia.django.newsletter, admin, contenttypes and tagging in the INSTALLED_APPS section of your project’s settings.
INSTALLED_APPS = ( # Your favorites apps 'django.contrib.contenttypes', 'django.contrib.sites', 'django.contrib.admin', 'django.contrib.sessions', 'tagging', 'emencia.django.newsletter',)
In your project urls.py adding this following line to include the newsletter’s urls for serving the newsletters in HTML.
Note this urlset is provided for convenient usage, but you can do something like that if you want to customize your urls :
url(r'^newsletters/', include('emencia.django.newsletter.urls.newsletter')), url(r'^mailing/', include('emencia.django.newsletter.urls.mailing_list')), url(r'^tracking/', include('emencia.django.newsletter.urls.tracking')), url(r'^statistics/', include('emencia.django.newsletter.urls.statistics')),
You have to make a symbolic link from emencia/django/newsletter/media/edn/ directory to your media directory or make a copy named edn, but if want to change this value, define NEWSLETTER_MEDIA_URL in the settings.py as appropriate.
Don’t forget to serve this url.
Now you can run a syncdb for installing the models into your database.
You have to add in your settings the email address used to send the newsletter :
NEWSLETTER_DEFAULT_HEADER_SENDER = 'My NewsLetter <email@example.com>'
It’s not recommended to use SQLite for production use. Because is limited to 999 variables into a SQL query, you can not create a Mailing List greater than this limitations in the Django’s admin modules. Prefer MySQL ou PgSQL.
A Buildout script is provided to properly initialize the project for anybody who wants to contribute.
First of all, please use VirtualEnv to protect your system.
Follow these steps to start the development :
$ git clone git://github.com/Fantomas42/emencia-django-newsletter.git $ virtualenv --no-site-packages emencia-django-newsletter $ cd emencia-django-newsletter $ source ./bin/activate $ python bootstrap.py $ ./bin/buildout
The buildout script will resolve all the dependancies needed to develop the application.
Once these operations are done, you are ready to develop on the project.
Run this command to launch the tests.
Or you can also launch the demo.
$ ./bin/demo syncdb $ ./bin/demo runserver
Pretty easy no ?
If you want to contribute by updating a translation or adding a translation in your language, it’s simple: create a account on Transifex.net and you will be able to edit the translations at this URL :
The translations hosted on Transifex.net will be pulled periodically in the repository, but if you are in a hurry, send me a message.
- Use UTM Tags
- Demo in the package
- Improving importation
- Premailer for HTML page.
- New importation capabilities
- Compatibility with django 1.3.1
- Unique key variable for newsletter’s title
- A lot of bug fixes
- Plugin for django-cms
- Multiple importation format
- Compatibility with django 1.2
- A lot of bug fixes
- Initial release