mirror of
https://github.com/pacnpal/django-anymail.git
synced 2025-12-20 03:41:05 -05:00
SendGrid: Improve esp_extra["personalizations"] handling.
Allow merging `esp_extra["personalizations"]` dict into other message-derived personalizations. (See comments in #120)
This commit is contained in:
@@ -123,6 +123,12 @@ Your :attr:`esp_extra` dict will be deeply merged into the
|
||||
parameters Anymail has constructed for the send, with `esp_extra`
|
||||
having precedence in conflicts.
|
||||
|
||||
Anymail has special handling for `esp_extra["personalizations"]`. If that value
|
||||
is a `dict`, Anymail will merge that personalizations dict into the personalizations
|
||||
for each message recipient. (If you pass a `list`, that will override the
|
||||
personalizations Anymail normally constructs from the message, and you will need to
|
||||
specify each recipient in the personalizations list yourself.)
|
||||
|
||||
Example:
|
||||
|
||||
.. code-block:: python
|
||||
@@ -140,6 +146,11 @@ Example:
|
||||
"substitution_tag": "%%OPEN_TRACKING_PIXEL%%",
|
||||
},
|
||||
},
|
||||
# Because "personalizations" is a dict, Anymail will merge "future_feature"
|
||||
# into the SendGrid personalizations array for each message recipient
|
||||
"personalizations": {
|
||||
"future_feature": {"future": "data"},
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user