mirror of
https://github.com/pacnpal/django-anymail.git
synced 2025-12-20 11:51:05 -05:00
Subaccounts: Document setting; verify message option overrides global setting
This commit is contained in:
@@ -12,3 +12,5 @@ peillis
|
||||
José Padilla
|
||||
Jens Alm
|
||||
Eric Hennings
|
||||
Michael Hobbs
|
||||
Sameer Al-Sakran
|
||||
|
||||
@@ -34,3 +34,14 @@ class DjrillMandrillSubaccountTests(DjrillBackendMockAPITestCase):
|
||||
self.assertEqual(len(data['message']['to']), 1)
|
||||
self.assertEqual(data['message']['to'][0]['email'], "to@example.com")
|
||||
self.assertEqual(data['message']['subaccount'], settings.MANDRILL_SUBACCOUNT)
|
||||
|
||||
def test_subaccount_message_overrides_setting(self):
|
||||
settings.MANDRILL_SUBACCOUNT = "global_setting_subaccount"
|
||||
message = mail.EmailMessage(
|
||||
'Subject here', 'Here is the message',
|
||||
'from@example.com', ['to@example.com'])
|
||||
message.subaccount = "individual_message_subaccount" # should override global setting
|
||||
message.send()
|
||||
self.assert_mandrill_called("/messages/send.json")
|
||||
data = self.get_api_call_data()
|
||||
self.assertEqual(data['message']['subaccount'], "individual_message_subaccount")
|
||||
|
||||
@@ -15,6 +15,8 @@ library from Kenneth Reitz.
|
||||
Configuration
|
||||
-------------
|
||||
|
||||
.. setting:: MANDRILL_API_KEY
|
||||
|
||||
In your project's :file:`settings.py`:
|
||||
|
||||
1. Add :mod:`djrill` to your :setting:`INSTALLED_APPS`::
|
||||
@@ -40,6 +42,26 @@ Djrill includes optional support for Mandrill webhooks, including inbound email.
|
||||
See the Djrill :ref:`webhooks <webhooks>` section for configuration details.
|
||||
|
||||
|
||||
Mandrill Subaccounts (Optional)
|
||||
-------------------------------
|
||||
|
||||
.. setting:: MANDRILL_SUBACCOUNT
|
||||
|
||||
If you are using Mandrill's `subaccounts`_ feature, you can globally set the
|
||||
subaccount for all messages sent through Djrill::
|
||||
|
||||
MANDRILL_SUBACCOUNT = "client-347"
|
||||
|
||||
(You can also set or override the :attr:`subaccount` on each individual message,
|
||||
with :ref:`Mandrill-specific sending options <mandrill-send-support>`.)
|
||||
|
||||
.. versionadded:: 1.0
|
||||
MANDRILL_SUBACCOUNT global setting
|
||||
|
||||
|
||||
.. _subaccounts: http://help.mandrill.com/entries/25523278-What-are-subaccounts-
|
||||
|
||||
|
||||
Admin (Optional)
|
||||
----------------
|
||||
|
||||
|
||||
@@ -199,6 +199,8 @@ Most of the options from the Mandrill
|
||||
.. attribute:: subaccount
|
||||
|
||||
``str``: the ID of one of your subaccounts to use for sending this message.
|
||||
(The subaccount on an individual message will override any global
|
||||
:setting:`MANDRILL_SUBACCOUNT` setting.)
|
||||
|
||||
.. versionadded:: 0.7
|
||||
|
||||
|
||||
Reference in New Issue
Block a user