-
Notifications
You must be signed in to change notification settings - Fork 70
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jose Zamora
committed
Oct 3, 2019
1 parent
100a20c
commit 47d9c34
Showing
1 changed file
with
12 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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: | ||
|