<commit_before>django-mailviews
================

Class-based email views for the Django framework, including a message previewer.

Introduction
------------

Rendering and sending emails in Django can quickly become repetitive and
error-prone. By encapsulating message rendering within view classes, you can
easily compose messages in a structured and clear manner.

Basic Usage
-----------

.. code:: python

    from mailviews.messages import EmailMessageView

    # Subclass the `EmailMessageView`, adding the templates you want to render.
    class WelcomeMessageView(EmailMessageView):
        subject_template_name = 'emails/welcome/subject.txt'
        body_template_name = 'emails/welcome/body.txt'

    # Instantiate and send a message.
    message = WelcomeMessageView().send(extra_context={
        'user': user,
    }, to=(user.email,))

This isn't actually the best pattern for sending messages to a user -- read the
notes under "Best Practices" for a better approach.
<commit_msg>Add build status image<commit_after>django-mailviews
================

Class-based email views for the Django framework, including a message previewer.

.. image:: https://travis-ci.org/disqus/django-mailviews.png?branch=master
   :target: https://travis-ci.org/disqus/django-mailviews

Introduction
------------

Rendering and sending emails in Django can quickly become repetitive and
error-prone. By encapsulating message rendering within view classes, you can
easily compose messages in a structured and clear manner.

Basic Usage
-----------

.. code:: python

    from mailviews.messages import EmailMessageView

    # Subclass the `EmailMessageView`, adding the templates you want to render.
    class WelcomeMessageView(EmailMessageView):
        subject_template_name = 'emails/welcome/subject.txt'
        body_template_name = 'emails/welcome/body.txt'

    # Instantiate and send a message.
    message = WelcomeMessageView().send(extra_context={
        'user': user,
    }, to=(user.email,))

This isn't actually the best pattern for sending messages to a user -- read the
notes under "Best Practices" for a better approach.

{'fraction_non_alphanumeric': 0.10736052508204406, 'fraction_numerical': 0.0, 'mean_word_length': 3.700440528634361, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2669897', 'n_tokens_mistral': 564, 'n_tokens_neox': 543, 'n_words': 205}