()
| 189 | |
| 190 | # snippet-start:[python.example_code.ses.Scenario_Templates] |
| 191 | def usage_demo(): |
| 192 | print("-" * 88) |
| 193 | print( |
| 194 | "Welcome to the Amazon Simple Email Service (Amazon SES) email template " |
| 195 | "demo!" |
| 196 | ) |
| 197 | print("-" * 88) |
| 198 | |
| 199 | logging.basicConfig(level=logging.INFO, format="%(levelname)s: %(message)s") |
| 200 | |
| 201 | ses_template = SesTemplate(boto3.client("ses")) |
| 202 | template = { |
| 203 | "name": "doc-example-template", |
| 204 | "subject": "Example of an email template.", |
| 205 | "text": "This is what {{name}} will {{action}} if {{name}} can't display HTML.", |
| 206 | "html": "<p><i>This</i> is what {{name}} will {{action}} if {{name}} " |
| 207 | "<b>can</b> display HTML.</p>", |
| 208 | } |
| 209 | print("Creating an email template.") |
| 210 | ses_template.create_template(**template) |
| 211 | print("Getting the list of template metadata.") |
| 212 | template_metas = ses_template.list_templates() |
| 213 | for temp_meta in template_metas: |
| 214 | print(f"Got template {temp_meta['Name']}:") |
| 215 | temp_data = ses_template.get_template(temp_meta["Name"]) |
| 216 | pprint(temp_data) |
| 217 | print(f"Deleting template {template['name']}.") |
| 218 | ses_template.delete_template() |
| 219 | |
| 220 | print("Thanks for watching!") |
| 221 | print("-" * 88) |
| 222 | |
| 223 | |
| 224 | # snippet-end:[python.example_code.ses.Scenario_Templates] |
no test coverage detected