Skip to content

Commit

Permalink
Documenting extra fields in Django
Browse files Browse the repository at this point in the history
  • Loading branch information
Jose Zamora committed Oct 3, 2019
1 parent 100a20c commit 47d9c34
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions docs/django/backend.rst
Original file line number Diff line number Diff line change
Expand Up @@ -47,23 +47,28 @@ Django is now configured to use the SparkPost email backend. You can now send ma
html_message='<p>Hello Rock stars!</p>',
)
You can also use `EmailMessage` or `EmailMultiAlternatives` class directly. That will give you access to more specific fileds like `template`:
You can also use `EmailMessage` or `EmailMultiAlternatives` class directly.
This allows you to set additional SparkPost fields: `template`, `substitution_data`, `campaign`, `metadata`:

.. code-block:: python
email = EmailMessage(
to=[
{
"address": "[email protected]",
"substitution_data": {
"key": "value"
}
'address': '[email protected]',
'substitution_data': {
'reward-level': 'Silver'
},
'metadata': {'user-id': '46576432465'}
}
],
from_email='[email protected]'
)
email.template = 'template-id'
email.substitution_data = {'season': 'Winter'}
email.metadata = {'cart-id': '74562657874'}
email.campaign = 'campaign-id'
email.send()
Or cc, bcc, reply to, or attachments fields:
Expand Down

0 comments on commit 47d9c34

Please sign in to comment.