previewTemplate()

Overview

public struct function previewTemplate(
      required string  template         
    ,          boolean allowDrafts       = false
    ,          numeric version           = 0
    ,          string  previewRecipient  = ""
    ,          boolean useDefaultContent = false
)

Prepares an email message ready for preview (returns a struct with subject, htmlBody + textBody keys)

Arguments

NameTypeRequiredDescription
templatestringYesThe ID of the template to send
allowDraftsbooleanNo (default=false)Whether or not to allow draft versions of the template
versionnumericNo (default=0)A specific version number to preview (default is latest)
previewRecipientstringNo (default="")Optional ID of a recipient whose preview parameters we will fetch and whose context data to use when rendering the email content
useDefaultContentbooleanNo (default=false)