diff --git a/djrill/mail/backends/djrill.py b/djrill/mail/backends/djrill.py index c0ed3f3..3fc6ab7 100644 --- a/djrill/mail/backends/djrill.py +++ b/djrill/mail/backends/djrill.py @@ -194,6 +194,7 @@ class DjrillBackend(BaseEmailBackend): 'track_opens', 'track_clicks', 'auto_text', 'auto_html', 'inline_css', 'url_strip_qs', 'tracking_domain', 'signing_domain', 'return_path_domain', + 'merge_language', 'tags', 'preserve_recipients', 'view_content_link', 'subaccount', 'google_analytics_domains', 'google_analytics_campaign', 'metadata'] diff --git a/djrill/tests/test_mandrill_send.py b/djrill/tests/test_mandrill_send.py index 0d3b47a..4c25fb9 100644 --- a/djrill/tests/test_mandrill_send.py +++ b/djrill/tests/test_mandrill_send.py @@ -343,6 +343,7 @@ class DjrillMandrillFeatureTests(DjrillBackendMockAPITestCase): def test_merge(self): # Djrill expands simple python dicts into the more-verbose name/content # structures the Mandrill API uses + self.message.merge_language = "mailchimp" self.message.global_merge_vars = { 'GREETING': "Hello", 'ACCOUNT_TYPE': "Basic" } self.message.merge_vars = { @@ -352,6 +353,7 @@ class DjrillMandrillFeatureTests(DjrillBackendMockAPITestCase): } self.message.send() data = self.get_api_call_data() + self.assertEqual(data['message']['merge_language'], "mailchimp") self.assertEqual(data['message']['global_merge_vars'], [ {'name': 'ACCOUNT_TYPE', 'content': "Basic"}, {'name': "GREETING", 'content': "Hello"} ]) @@ -456,6 +458,7 @@ class DjrillMandrillFeatureTests(DjrillBackendMockAPITestCase): self.assertFalse('google_analytics_domains' in data['message']) self.assertFalse('google_analytics_campaign' in data['message']) self.assertFalse('metadata' in data['message']) + self.assertFalse('merge_language' in data['message']) self.assertFalse('global_merge_vars' in data['message']) self.assertFalse('merge_vars' in data['message']) self.assertFalse('recipient_metadata' in data['message']) diff --git a/djrill/tests/test_mandrill_send_template.py b/djrill/tests/test_mandrill_send_template.py index c1d9569..8a3760e 100644 --- a/djrill/tests/test_mandrill_send_template.py +++ b/djrill/tests/test_mandrill_send_template.py @@ -48,7 +48,6 @@ class DjrillMandrillSendTemplateTests(DjrillBackendMockAPITestCase): msg.use_template_from = True with self.assertRaises(MandrillAPIError): msg.send() - self.assertEqual(sent, 0) def test_send_template_without_subject_field(self): msg = mail.EmailMessage('Subject', 'Text Body', diff --git a/docs/usage/sending_mail.rst b/docs/usage/sending_mail.rst index d186fc4..1417209 100644 --- a/docs/usage/sending_mail.rst +++ b/docs/usage/sending_mail.rst @@ -171,6 +171,13 @@ Most of the options from the Mandrill .. versionadded:: 0.7 +.. attribute:: merge_language + + ``str``: the merge tag language if using merge tags -- e.g., "mailchimp" or "handlebars". + Default from your Mandrill account settings. + + .. versionadded:: 1.3 + .. attribute:: global_merge_vars ``dict``: merge variables to use for all recipients (most useful with :ref:`mandrill-templates`). ::