Skip to main content

A simple and customizable email template built for Django

Project description

django-simple-mail v2.0.0 on PyPi MIT license Stable

django-simple-mail

Simple customizable email template built for Django

Requirements

These Django app works with :

  • Python (>=2.7) (Need to be tested for 3.x)

  • Django (>=1.9) (Need to be tested for previous versions)

Installation

Install using pip :

pip install django_simple_mail

Add simple_mail and solo to your INSTALLED_APPS setting.

INSTALLED_APPS = (
    ...
    'simple_mail',
    'solo'
)

Then run :

python manage.py makemigrations python manage.py migrate

Register mails

Create a mails.py file in your app and define your mail :

from simple_mail.mailer import BaseSimpleMail, simple_mailer


class WelcomeMail(BaseSimpleMail):
    email_key = 'welcome'


simple_mailer.register(WelcomeMail)

Then run ./manage.py register_mails to create those mail into the database.

Send an email

You can the send the WelcomeEmail the following way :

welcome_email = WelcomeEmail()
welcome_email.set_context(args, kwargs)
welcome_email.send(to, from_email=None, bcc=[], connection=None, attachments=[],
                   headers={}, cc=[], reply_to=[], fail_silently=False)

Preview and customization:

The default mail template is built with Cerberus and looks like this with placeholder values:

Email Preview

Email Preview

Django Admin

You can customize the colors and base content of your template directly inside the admin.

You can manage your emails and their content directly from django admin :

Admin Preview

Admin Preview

You can also use variables inside the fields to make your content more dynamic :

Admin Preview

Admin Preview

Support

If you are having issues, please let us know or submit a pull request.

License

The project is licensed under the MIT License.

Project details


Download files

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

Source Distribution

django_simple_mail-2.0.0.tar.gz (14.2 kB view hashes)

Uploaded Source

Built Distribution

django_simple_mail-2.0.0-py2.py3-none-any.whl (16.0 kB view hashes)

Uploaded Python 2 Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page