Skip to content

Commit 00a81ed

Browse files
author
Rich Leland
committed
Add sub data example with note. Refs #62
1 parent 131bc62 commit 00a81ed

File tree

2 files changed

+29
-2
lines changed

2 files changed

+29
-2
lines changed

docs/resources/transmissions.rst

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,33 @@ Sending an attachment
8181
)
8282
8383
84+
Using substitution data
85+
***********************
86+
87+
.. note::
88+
89+
Substitution data can be specified at the template, transmission and recipient levels. The order of precedence is as follows: recipient overrides transmission overrides template.
90+
91+
.. code-block:: python
92+
93+
from sparkpost import SparkPost
94+
95+
sp = SparkPost()
96+
97+
sp.transmissions.send(
98+
recipients=['[email protected]'],
99+
text="Hello {{name}}",
100+
html='<p>Hello {{name}}</p>',
101+
from_email='[email protected]',
102+
subject='Hello from python-sparkpost',
103+
track_opens=True,
104+
track_clicks=True,
105+
substitution_data={
106+
'name': 'Sparky'
107+
}
108+
)
109+
110+
84111
Using a stored template
85112
***********************
86113

examples/transmissions/send_transmission.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@
1818
}
1919
}
2020
],
21-
html='<p>Hello world {{name}}</p>',
22-
text='Hello world {{name}}',
21+
html='<p>Hello {{name}}</p>',
22+
text='Hello {{name}}',
2323
from_email='[email protected]',
2424
subject='Example Script',
2525
description='contrived example',

0 commit comments

Comments
 (0)