Personalization

open class Personalization : Encodable, EmailHeaderRepresentable, Scheduling

The Personalization struct is used by the Email class to add personalization settings to an email. The only required property is the to property, and each email must have at least one personalization.

  • to

    An array of recipients to send the email to.

    Declaration

    Swift

    public var to: [Address]
  • cc

    An array of recipients to add as a CC on the email.

    Declaration

    Swift

    open var cc: [Address]?
  • bcc

    An array of recipients to add as a BCC on the email.

    Declaration

    Swift

    open var bcc: [Address]?
  • A personalized subject for the email.

    Declaration

    Swift

    open var subject: String?
  • An optional set of headers to add to the email in this personalization. Each key in the dictionary should represent the name of the header, and the values of the dictionary should be equal to the values of the headers.

    Declaration

    Swift

    open var headers: [String : String]?
  • An optional set of substitutions to replace in this personalization. The keys in the dictionary should represent the substitution tags that should be replaced, and the values should be the replacement values.

    Declaration

    Swift

    open var substitutions: [String : String]?
  • A set of custom arguments to add to the email. The keys of the dictionary should be the names of the custom arguments, while the values should represent the value of each custom argument.

    Declaration

    Swift

    open var customArguments: [String : String]?
  • An optional time to send the email at.

    Declaration

    Swift

    open var sendAt: Date?
  • Initializes the email with all the available properties.

    Declaration

    Swift

    public init(to: [Address], cc: [Address]? = nil, bcc: [Address]? = nil, subject: String? = nil, headers: [String : String]? = nil, substitutions: [String : String]? = nil, customArguments: [String : String]? = nil, sendAt: Date? = nil)

    Parameters

    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(recipients: String...)

    Parameters

    recipients

    A list of email addresses to use as the to addresses.

  • Validates that the personalization has recipients and that they are proper email addresses as well as making sure the sendAt date is valid.

    Declaration

    Swift

    open func validate() throws