Skip to main content
https://secure.travis-ci.org/rafales/django-classymail.png?branch=master

Django makes it really easy to send simple e-mail messages. But e-mails sometimes gets really complicated and un-DRY. That’s where ClassyMail steps in.

Django-ClassyMail is a library for building e-mail messages in a fashion similar to django’s class based views.

You can create mixins, override attributes with keyword arguments and there’s a lot of builtin functionality. Just like class based views.

Django-ClassyMail will handle css inlining, timezone, language and urls for you.

Read the docs for more info:

https://django-classymail.readthedocs.org/en/latest/

And here’s an example:

class UserMixin(ClassyMail):
    """
    Sets language and timezone according to user preferences, adds "user" to
    template context and sets recipient to user's email address.
    """
    user = None

    def get_timezone(self):
        return self.user.get_profile().timezone

    def get_language(self):
        return self.user.get_profile().language

    def get_to(self):
        return [self.user.email]

    def get_context_data(self):
        data = super(UserMixin, self).get_context_data()
        data['user'] = self.user
        return data

class WelcomeEmail(UserMixin, ClassyMail):
    html_template_name = 'emails/welcome.html'
    text_template_name = 'emails/welcome.txt'

    def get_subject(self):
        return _("Welcome %s! Thanks for joining us!") % self.user.first_name

Release files for django-classymail 0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-classymail 0.2
File Size Uploaded
django-classymail-0.2.tar.gz 5.8 kB Details

Release files / django-classymail-0.2.tar.gz

Download URL django-classymail-0.2.tar.gz
Size 5.8 kB
Tags Source
SHA-256 checksum
How to use checksums
ef39a2a93f3567cb5b2fe4739db4f0cd1b176267d4262b9ed3792caf8b807954
BLAKE2b-256 checksum
How to use checksums
46c83d22db25fa36e8c273824108f0fd1b3b694188567c70f9298708a2150fe8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.2 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page