Skip to content

Commit cc143a2

Browse files
author
Jose Zamora
committed
Documenting extra fields in Django
1 parent a55235b commit cc143a2

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
@@ -44,23 +44,28 @@ Django is now configured to use the SparkPost email backend. You can now send ma
4444
html_message='<p>Hello Rock stars!</p>',
4545
)
4646
47-
48-
You can also use `EmailMessage` or `EmailMultiAlternatives` class directly. That will give you access to more specific fileds like `template`:
47+
48+
You can also use `EmailMessage` or `EmailMultiAlternatives` class directly.
49+
This allows you to set additional SparkPost fields: `template`, `substitution_data`, `campaign`, `metadata`:
4950

5051
.. code-block:: python
51-
52+
5253
email = EmailMessage(
5354
to=[
5455
{
55-
"address": "[email protected]",
56-
"substitution_data": {
57-
"key": "value"
58-
}
56+
'address': '[email protected]',
57+
'substitution_data': {
58+
'reward-level': 'Silver'
59+
},
60+
'metadata': {'user-id': '46576432465'}
5961
}
6062
],
6163
from_email='[email protected]'
6264
)
6365
email.template = 'template-id'
66+
email.substitution_data = {'season': 'Winter'}
67+
email.metadata = {'cart-id': '74562657874'}
68+
email.campaign = 'campaign-id'
6469
email.send()
6570
6671
Or cc, bcc, reply to, or attachments fields:

0 commit comments

Comments
 (0)