Skip to content

Commit 47d9c34

Browse files
author
Jose Zamora
committed
Documenting extra fields in Django
1 parent 100a20c commit 47d9c34

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

docs/django/backend.rst

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,23 +47,28 @@ Django is now configured to use the SparkPost email backend. You can now send ma
4747
html_message='<p>Hello Rock stars!</p>',
4848
)
4949
50-
51-
You can also use `EmailMessage` or `EmailMultiAlternatives` class directly. That will give you access to more specific fileds like `template`:
50+
51+
You can also use `EmailMessage` or `EmailMultiAlternatives` class directly.
52+
This allows you to set additional SparkPost fields: `template`, `substitution_data`, `campaign`, `metadata`:
5253

5354
.. code-block:: python
54-
55+
5556
email = EmailMessage(
5657
to=[
5758
{
58-
"address": "[email protected]",
59-
"substitution_data": {
60-
"key": "value"
61-
}
59+
'address': '[email protected]',
60+
'substitution_data': {
61+
'reward-level': 'Silver'
62+
},
63+
'metadata': {'user-id': '46576432465'}
6264
}
6365
],
6466
from_email='[email protected]'
6567
)
6668
email.template = 'template-id'
69+
email.substitution_data = {'season': 'Winter'}
70+
email.metadata = {'cart-id': '74562657874'}
71+
email.campaign = 'campaign-id'
6772
email.send()
6873
6974
Or cc, bcc, reply to, or attachments fields:

0 commit comments

Comments
 (0)