Skip to content

Commit

Permalink
Add sub data example with note. Refs #62
Browse files Browse the repository at this point in the history
  • Loading branch information
Rich Leland committed Feb 26, 2016
1 parent 131bc62 commit 00a81ed
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 2 deletions.
27 changes: 27 additions & 0 deletions docs/resources/transmissions.rst
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,33 @@ Sending an attachment
)
Using substitution data
***********************

.. note::

Substitution data can be specified at the template, transmission and recipient levels. The order of precedence is as follows: recipient overrides transmission overrides template.

.. code-block:: python
from sparkpost import SparkPost
sp = SparkPost()
sp.transmissions.send(
recipients=['someone@somedomain.com'],
text="Hello {{name}}",
html='<p>Hello {{name}}</p>',
from_email='test@sparkpostbox.com',
subject='Hello from python-sparkpost',
track_opens=True,
track_clicks=True,
substitution_data={
'name': 'Sparky'
}
)
Using a stored template
***********************

Expand Down
4 changes: 2 additions & 2 deletions examples/transmissions/send_transmission.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
}
}
],
html='<p>Hello world {{name}}</p>',
text='Hello world {{name}}',
html='<p>Hello {{name}}</p>',
text='Hello {{name}}',
from_email='test@sparkpostbox.com',
subject='Example Script',
description='contrived example',
Expand Down

0 comments on commit 00a81ed

Please sign in to comment.