Skip to contents

template_id must be included for this data to be applied.

Usage

dynamic_template_data(sg_mail, data)

Arguments

sg_mail

(required) mail object from package

data

A key-value list for template data. (See https://docs.sendgrid.com/ui/sending-email/how-to-send-an-email-with-dynamic-templates)

Value

sg_mail class with template data for dynamic transactional templates

Examples

data_lst <-
  list(
    first_name = "Amanda",
    link = "foo"
  )

mail() %>%
  template_id("d-4ad23ad40a0e47d0a0232b85f24ca5c2")%>%
  dynamic_template_data(data_lst)
#> SendGrid Mail - 
#>    from   : (required)
#>    to     : (required)
#>    subject: (required)
#>    template_id: nchr[34] d-4ad23ad40a0e47d0a0232b85f24ca5c2
#>      data: json below
#> {
#>   "first_name": "Amanda",
#>   "link": "foo"
#> } 
#>    attach : (optional)