diff --git a/djrill/mail/backends/djrill.py b/djrill/mail/backends/djrill.py index 754d773..4b39067 100644 --- a/djrill/mail/backends/djrill.py +++ b/djrill/mail/backends/djrill.py @@ -145,7 +145,9 @@ class DjrillBackend(BaseEmailBackend): # Mandrill attributes that can be copied directly: mandrill_attrs = [ 'from_name', # overrides display name parsed from from_email above - 'track_opens', 'track_clicks', 'auto_text', 'inline_css', 'url_strip_qs', + 'track_opens', 'track_clicks', 'auto_text', 'auto_html', + 'inline_css', 'url_strip_qs', + 'tracking_domain', 'signing_domain', 'tags', 'preserve_recipients', 'google_analytics_domains', 'google_analytics_campaign', 'metadata'] diff --git a/djrill/tests/test_mandrill_send.py b/djrill/tests/test_mandrill_send.py index ab309c1..b367830 100644 --- a/djrill/tests/test_mandrill_send.py +++ b/djrill/tests/test_mandrill_send.py @@ -296,13 +296,19 @@ class DjrillMandrillFeatureTests(DjrillBackendMockAPITestCase): def test_message_options(self): self.message.auto_text = True + self.message.auto_html = True self.message.inline_css = True self.message.preserve_recipients = True + self.message.tracking_domain = "click.example.com" + self.message.signing_domain = "example.com" self.message.send() data = self.get_api_call_data() self.assertEqual(data['message']['auto_text'], True) + self.assertEqual(data['message']['auto_html'], True) self.assertEqual(data['message']['inline_css'], True) self.assertEqual(data['message']['preserve_recipients'], True) + self.assertEqual(data['message']['tracking_domain'], "click.example.com") + self.assertEqual(data['message']['signing_domain'], "example.com") def test_merge(self): # Djrill expands simple python dicts into the more-verbose name/content @@ -377,10 +383,13 @@ class DjrillMandrillFeatureTests(DjrillBackendMockAPITestCase): self.assertFalse('track_opens' in data['message']) self.assertFalse('track_clicks' in data['message']) self.assertFalse('auto_text' in data['message']) + self.assertFalse('auto_html' in data['message']) self.assertFalse('inline_css' in data['message']) self.assertFalse('url_strip_qs' in data['message']) self.assertFalse('tags' in data['message']) self.assertFalse('preserve_recipients' in data['message']) + self.assertFalse('tracking_domain' in data['message']) + self.assertFalse('signing_domain' in data['message']) self.assertFalse('google_analytics_domains' in data['message']) self.assertFalse('google_analytics_campaign' in data['message']) self.assertFalse('metadata' in data['message']) diff --git a/docs/history.rst b/docs/history.rst index 5373f35..e5ecf39 100644 --- a/docs/history.rst +++ b/docs/history.rst @@ -1,6 +1,12 @@ Release Notes ============= +Version 0.5 (development): + +* Support for Mandrill send options :attr:`auto_html`, :attr:`tracking_domain` + and :attr:`signing_domain`. + + Version 0.4: * Attachments with a Content-ID are now treated as diff --git a/docs/usage/sending_mail.rst b/docs/usage/sending_mail.rst index 5318468..cc21ab6 100644 --- a/docs/usage/sending_mail.rst +++ b/docs/usage/sending_mail.rst @@ -109,6 +109,8 @@ Most of the options from the Mandrill `message` struct can be set directly on an :class:`~django.core.mail.EmailMessage` (or subclass) object: +.. These attributes are in the same order as they appear in the Mandrill API docs... + .. attribute:: track_opens ``Boolean``: whether Mandrill should enable open-tracking for this message. @@ -132,6 +134,11 @@ Most of the options from the Mandrill ``Boolean``: whether Mandrill should automatically generate a text body from the HTML. Default from your Mandrill account settings. +.. attribute:: auto_html + + ``Boolean``: whether Mandrill should automatically generate an HTML body from the plaintext. + Default from your Mandrill account settings. + .. attribute:: inline_css ``Boolean``: whether Mandrill should inline CSS styles in the HTML. @@ -149,6 +156,18 @@ Most of the options from the Mandrill ``Boolean``: whether Mandrill should include all recipients in the "to" message header. Default from your Mandrill account settings. +.. attribute:: tracking_domain + + ``str``: domain Mandrill should use to rewrite tracked links and host tracking pixels + for this message. Useful if you send email from multiple domains. + Default from your Mandrill account settings. + +.. attribute:: signing_domain + + ``str``: domain Mandrill should for DKIM signing and SPF on this message. + Useful if you send email from multiple domains. + Default from your Mandrill account settings. + .. attribute:: global_merge_vars ``dict``: merge variables to use for all recipients (most useful with :ref:`mandrill-templates`). ::