TemplatedPersonalization
open class TemplatedPersonalization<TemplateData> : Personalization where TemplateData : Encodable
The TemplatedPersonalization
class is a subclass of Personalization
, and
is used if you are using the Dynamic Templates feature.
There is a generic
TemplateData
type that you can specify which represents the substitution
data. An example of using this class might look something like this:
// First let's define our dynamic data types:
struct CheckoutData: Encodable {
let total: String
let items: [String]
let receipt: Bool
}
// Next let's create the personalization.
let thisData = CheckoutData(total: "$239.85",
items: ["Shoes", "Shirt"],
receipt: true)
let personalization = TemplatedPersonalization(dynamicTemplateData: thisData,
recipients: "foo@bar.example")
-
The handlebar substitutions that will be applied to the dynamic template specified in the
templateID
on theEmail
.Declaration
Swift
open var dynamicTemplateData: TemplateData
-
Initializes the email with all the available properties.
Declaration
Parameters
dynamicTemplateData
The handlebar substitution data that will be applied to the dynamic template.
to
An array of addresses to send the email to.
cc
An array of addresses to add as CC.
bcc
An array of addresses to add as BCC.
subject
A subject to use in the personalization.
headers
A set of additional headers to add for this personalization. The keys and values in the dictionary should represent the name of the headers and their values, respectively.
substitutions
A set of substitutions to make in this personalization. The keys and values in the dictionary should represent the substitution tags and their replacement values, respectively.
customArguments
A set of custom arguments to add to the personalization. The keys and values in the dictionary should represent the argument names and values, respectively.
sendAt
A time to send the email at.
-
Initializes the personalization with a set of email addresses.
Declaration
Swift
public convenience init(dynamicTemplateData: TemplateData, recipients: String...)