mirror of
https://github.com/pacnpal/django-anymail.git
synced 2025-12-20 11:51:05 -05:00
Improve and document JSON serialization for Mandrill API
* Add some context to exceptions on unserializable values (addresses #89). * Document need to format merge data (into something JSON-serializable). * Add RemovedInDjrill2 DeprecationWarning. * Deprecate blanket date/datetime serialization.
This commit is contained in:
@@ -198,6 +198,9 @@ Most of the options from the Mandrill
|
||||
|
||||
message.global_merge_vars = {'company': "ACME", 'offer': "10% off"}
|
||||
|
||||
Merge data must be strings or other JSON-serializable types.
|
||||
(See :ref:`formatting-merge-data` for details.)
|
||||
|
||||
.. attribute:: merge_vars
|
||||
|
||||
``dict``: per-recipient merge variables (most useful with :ref:`mandrill-templates`). The keys
|
||||
@@ -209,6 +212,9 @@ Most of the options from the Mandrill
|
||||
'rr@example.com': {'offer': "instant tunnel paint"}
|
||||
}
|
||||
|
||||
Merge data must be strings or other JSON-serializable types.
|
||||
(See :ref:`formatting-merge-data` for details.)
|
||||
|
||||
.. attribute:: tags
|
||||
|
||||
``list`` of ``str``: tags to apply to the message, for filtering reports in the Mandrill
|
||||
@@ -245,12 +251,18 @@ Most of the options from the Mandrill
|
||||
|
||||
message.metadata = {'customer': customer.id, 'order': order.reference_number}
|
||||
|
||||
Mandrill restricts metadata keys to alphanumeric characters and underscore, and
|
||||
metadata values to numbers, strings, boolean values, and None (null).
|
||||
|
||||
.. attribute:: recipient_metadata
|
||||
|
||||
``dict``: per-recipient metadata values. Keys are the recipient email addresses,
|
||||
and values are dicts of metadata for each recipient (similar to
|
||||
:attr:`merge_vars`)
|
||||
|
||||
Mandrill restricts metadata keys to alphanumeric characters and underscore, and
|
||||
metadata values to numbers, strings, boolean values, and None (null).
|
||||
|
||||
.. attribute:: async
|
||||
|
||||
``Boolean``: whether Mandrill should use an async mode optimized for bulk sending.
|
||||
|
||||
Reference in New Issue
Block a user