mirror of
https://github.com/pacnpal/django-anymail.git
synced 2025-12-20 11:51:05 -05:00
Support important, view_content_link, return_path_domain, subaccount.
Closes #49.
This commit is contained in:
@@ -178,10 +178,11 @@ class DjrillBackend(BaseEmailBackend):
|
|||||||
# Mandrill attributes that can be copied directly:
|
# Mandrill attributes that can be copied directly:
|
||||||
mandrill_attrs = [
|
mandrill_attrs = [
|
||||||
'from_name', # overrides display name parsed from from_email above
|
'from_name', # overrides display name parsed from from_email above
|
||||||
|
'important',
|
||||||
'track_opens', 'track_clicks', 'auto_text', 'auto_html',
|
'track_opens', 'track_clicks', 'auto_text', 'auto_html',
|
||||||
'inline_css', 'url_strip_qs',
|
'inline_css', 'url_strip_qs',
|
||||||
'tracking_domain', 'signing_domain',
|
'tracking_domain', 'signing_domain', 'return_path_domain',
|
||||||
'tags', 'preserve_recipients',
|
'tags', 'preserve_recipients', 'view_content_link', 'subaccount',
|
||||||
'google_analytics_domains', 'google_analytics_campaign',
|
'google_analytics_domains', 'google_analytics_campaign',
|
||||||
'metadata']
|
'metadata']
|
||||||
for attr in mandrill_attrs:
|
for attr in mandrill_attrs:
|
||||||
|
|||||||
@@ -307,22 +307,30 @@ class DjrillMandrillFeatureTests(DjrillBackendMockAPITestCase):
|
|||||||
self.assertEqual(data['message']['url_strip_qs'], True)
|
self.assertEqual(data['message']['url_strip_qs'], True)
|
||||||
|
|
||||||
def test_message_options(self):
|
def test_message_options(self):
|
||||||
|
self.message.important = True
|
||||||
self.message.auto_text = True
|
self.message.auto_text = True
|
||||||
self.message.auto_html = True
|
self.message.auto_html = True
|
||||||
self.message.inline_css = True
|
self.message.inline_css = True
|
||||||
self.message.preserve_recipients = True
|
self.message.preserve_recipients = True
|
||||||
|
self.message.view_content_link = False
|
||||||
self.message.tracking_domain = "click.example.com"
|
self.message.tracking_domain = "click.example.com"
|
||||||
self.message.signing_domain = "example.com"
|
self.message.signing_domain = "example.com"
|
||||||
|
self.message.return_path_domain = "support.example.com"
|
||||||
|
self.message.subaccount = "marketing-dept"
|
||||||
self.message.async = True
|
self.message.async = True
|
||||||
self.message.ip_pool = "Bulk Pool"
|
self.message.ip_pool = "Bulk Pool"
|
||||||
self.message.send()
|
self.message.send()
|
||||||
data = self.get_api_call_data()
|
data = self.get_api_call_data()
|
||||||
|
self.assertEqual(data['message']['important'], True)
|
||||||
self.assertEqual(data['message']['auto_text'], True)
|
self.assertEqual(data['message']['auto_text'], True)
|
||||||
self.assertEqual(data['message']['auto_html'], True)
|
self.assertEqual(data['message']['auto_html'], True)
|
||||||
self.assertEqual(data['message']['inline_css'], True)
|
self.assertEqual(data['message']['inline_css'], True)
|
||||||
self.assertEqual(data['message']['preserve_recipients'], True)
|
self.assertEqual(data['message']['preserve_recipients'], True)
|
||||||
|
self.assertEqual(data['message']['view_content_link'], False)
|
||||||
self.assertEqual(data['message']['tracking_domain'], "click.example.com")
|
self.assertEqual(data['message']['tracking_domain'], "click.example.com")
|
||||||
self.assertEqual(data['message']['signing_domain'], "example.com")
|
self.assertEqual(data['message']['signing_domain'], "example.com")
|
||||||
|
self.assertEqual(data['message']['return_path_domain'], "support.example.com")
|
||||||
|
self.assertEqual(data['message']['subaccount'], "marketing-dept")
|
||||||
self.assertEqual(data['async'], True)
|
self.assertEqual(data['async'], True)
|
||||||
self.assertEqual(data['ip_pool'], "Bulk Pool")
|
self.assertEqual(data['ip_pool'], "Bulk Pool")
|
||||||
|
|
||||||
@@ -425,6 +433,7 @@ class DjrillMandrillFeatureTests(DjrillBackendMockAPITestCase):
|
|||||||
data = self.get_api_call_data()
|
data = self.get_api_call_data()
|
||||||
self.assertFalse('from_name' in data['message'])
|
self.assertFalse('from_name' in data['message'])
|
||||||
self.assertFalse('bcc_address' in data['message'])
|
self.assertFalse('bcc_address' in data['message'])
|
||||||
|
self.assertFalse('important' in data['message'])
|
||||||
self.assertFalse('track_opens' in data['message'])
|
self.assertFalse('track_opens' in data['message'])
|
||||||
self.assertFalse('track_clicks' in data['message'])
|
self.assertFalse('track_clicks' in data['message'])
|
||||||
self.assertFalse('auto_text' in data['message'])
|
self.assertFalse('auto_text' in data['message'])
|
||||||
@@ -433,8 +442,11 @@ class DjrillMandrillFeatureTests(DjrillBackendMockAPITestCase):
|
|||||||
self.assertFalse('url_strip_qs' in data['message'])
|
self.assertFalse('url_strip_qs' in data['message'])
|
||||||
self.assertFalse('tags' in data['message'])
|
self.assertFalse('tags' in data['message'])
|
||||||
self.assertFalse('preserve_recipients' in data['message'])
|
self.assertFalse('preserve_recipients' in data['message'])
|
||||||
|
self.assertFalse('view_content_link' in data['message'])
|
||||||
self.assertFalse('tracking_domain' in data['message'])
|
self.assertFalse('tracking_domain' in data['message'])
|
||||||
self.assertFalse('signing_domain' in data['message'])
|
self.assertFalse('signing_domain' in data['message'])
|
||||||
|
self.assertFalse('return_path_domain' in data['message'])
|
||||||
|
self.assertFalse('subaccount' in data['message'])
|
||||||
self.assertFalse('google_analytics_domains' in data['message'])
|
self.assertFalse('google_analytics_domains' in data['message'])
|
||||||
self.assertFalse('google_analytics_campaign' in data['message'])
|
self.assertFalse('google_analytics_campaign' in data['message'])
|
||||||
self.assertFalse('metadata' in data['message'])
|
self.assertFalse('metadata' in data['message'])
|
||||||
|
|||||||
@@ -3,7 +3,9 @@ Release Notes
|
|||||||
|
|
||||||
Version 0.7 (development):
|
Version 0.7 (development):
|
||||||
|
|
||||||
* Support for Mandrill send options :attr:`async`, :attr:`ip_pool`, and :attr:`send_at`
|
* Support for Mandrill send options :attr:`async`, :attr:`important`,
|
||||||
|
:attr:`ip_pool`, :attr:`return_path_domain`, :attr:`send_at`,
|
||||||
|
:attr:`subaccount`, and :attr:`view_content_link`
|
||||||
|
|
||||||
|
|
||||||
Version 0.6:
|
Version 0.6:
|
||||||
|
|||||||
@@ -111,6 +111,10 @@ Most of the options from the Mandrill
|
|||||||
|
|
||||||
.. These attributes are in the same order as they appear in the Mandrill API docs...
|
.. These attributes are in the same order as they appear in the Mandrill API docs...
|
||||||
|
|
||||||
|
.. attribute:: important
|
||||||
|
|
||||||
|
``Boolean``: whether Mandrill should send this message ahead of non-important ones.
|
||||||
|
|
||||||
.. attribute:: track_opens
|
.. attribute:: track_opens
|
||||||
|
|
||||||
``Boolean``: whether Mandrill should enable open-tracking for this message.
|
``Boolean``: whether Mandrill should enable open-tracking for this message.
|
||||||
@@ -156,6 +160,10 @@ Most of the options from the Mandrill
|
|||||||
``Boolean``: whether Mandrill should include all recipients in the "to" message header.
|
``Boolean``: whether Mandrill should include all recipients in the "to" message header.
|
||||||
Default from your Mandrill account settings.
|
Default from your Mandrill account settings.
|
||||||
|
|
||||||
|
.. attribute:: view_content_link
|
||||||
|
|
||||||
|
``Boolean``: set False on sensitive messages to instruct Mandrill not to log the content.
|
||||||
|
|
||||||
.. attribute:: tracking_domain
|
.. attribute:: tracking_domain
|
||||||
|
|
||||||
``str``: domain Mandrill should use to rewrite tracked links and host tracking pixels
|
``str``: domain Mandrill should use to rewrite tracked links and host tracking pixels
|
||||||
@@ -164,10 +172,14 @@ Most of the options from the Mandrill
|
|||||||
|
|
||||||
.. attribute:: signing_domain
|
.. attribute:: signing_domain
|
||||||
|
|
||||||
``str``: domain Mandrill should for DKIM signing and SPF on this message.
|
``str``: domain Mandrill should use for DKIM signing and SPF on this message.
|
||||||
Useful if you send email from multiple domains.
|
Useful if you send email from multiple domains.
|
||||||
Default from your Mandrill account settings.
|
Default from your Mandrill account settings.
|
||||||
|
|
||||||
|
.. attribute:: return_path_domain
|
||||||
|
|
||||||
|
``str``: domain Mandrill should use for the message's return-path.
|
||||||
|
|
||||||
.. attribute:: global_merge_vars
|
.. attribute:: global_merge_vars
|
||||||
|
|
||||||
``dict``: merge variables to use for all recipients (most useful with :ref:`mandrill-templates`). ::
|
``dict``: merge variables to use for all recipients (most useful with :ref:`mandrill-templates`). ::
|
||||||
@@ -193,6 +205,10 @@ Most of the options from the Mandrill
|
|||||||
|
|
||||||
message.tags = ["Order Confirmation", "Test Variant A"]
|
message.tags = ["Order Confirmation", "Test Variant A"]
|
||||||
|
|
||||||
|
.. attribute:: subaccount
|
||||||
|
|
||||||
|
``str``: the ID of one of your subaccounts to use for sending this message.
|
||||||
|
|
||||||
.. attribute:: google_analytics_domains
|
.. attribute:: google_analytics_domains
|
||||||
|
|
||||||
``list`` of ``str``: domain names for links where Mandrill should add Google Analytics
|
``list`` of ``str``: domain names for links where Mandrill should add Google Analytics
|
||||||
|
|||||||
Reference in New Issue
Block a user