Using Templates with the SparkPost WordPress Plugin

April 29, 2017 Contributors

When using templates with the SparkPost WordPress plugin, we pass through substitution data that you can use as variables in your template to specify some dynamic settings:

  • content – the main body of the email
  • subject – the subject of the email
  • from – the email address of the sender (e.g. Rick Sanchez
  • reply_to – the email address to use when users reply to your email

To use these variables in your templates, you’ll have to use our Templates API. Our web UI does not currently support using variables for from or reply_to. When you create or update your template, you can supply a payload that looks like this:

Note that content is enclosed in triple curly braces – this allows HTML content to be substituted. In the WordPress admin, on the settings screen for the SparkPost plugin, remember to fill in the Template field (in this example wordpress-testing):