Skip to content

Mandrill_Templates

Mathieu Nayrolles edited this page Jan 20, 2016 · 1 revision

Mandrill_Templates

  • Class name: Mandrill_Templates
  • Namespace:

Methods

__construct

mixed Mandrill_Templates::__construct(\Mandrill $master)
  • Visibility: public

Arguments

add

\struct Mandrill_Templates::add(string $name, string $from_email, string $from_name, string $subject, string $code, string $text, boolean $publish, array $labels)

Add a new template

  • Visibility: public

Arguments

  • $name string - <p>the name for the new template - must be unique</p>
  • $from_email string - <p>a default sending address for emails sent using this template</p>
  • $from_name string - <p>a default from name to be used</p>
  • $subject string - <p>a default subject line to be used</p>
  • $code string - <p>the HTML code for the template with mc:edit attributes for the editable elements</p>
  • $text string - <p>a default text part to be used when sending with this template</p>
  • $publish boolean - <p>set to false to add a draft template without publishing</p>
  • $labels array - <p>an optional array of up to 10 labels to use for filtering templates</p> <ul> <li>labels[] string a single label</li> </ul>

info

\struct Mandrill_Templates::info(string $name)

Get the information for an existing template

  • Visibility: public

Arguments

  • $name string - <p>the immutable name of an existing template</p>

update

\struct Mandrill_Templates::update(string $name, string $from_email, string $from_name, string $subject, string $code, string $text, boolean $publish, array $labels)

Update the code for an existing template. If null is provided for any fields, the values will remain unchanged.

  • Visibility: public

Arguments

  • $name string - <p>the immutable name of an existing template</p>
  • $from_email string - <p>the new default sending address</p>
  • $from_name string - <p>the new default from name</p>
  • $subject string - <p>the new default subject line</p>
  • $code string - <p>the new code for the template</p>
  • $text string - <p>the new default text part to be used</p>
  • $publish boolean - <p>set to false to update the draft version of the template without publishing</p>
  • $labels array - <p>an optional array of up to 10 labels to use for filtering templates</p> <ul> <li>labels[] string a single label</li> </ul>

publish

\struct Mandrill_Templates::publish(string $name)

Publish the content for the template. Any new messages sent using this template will start using the content that was previously in draft.

  • Visibility: public

Arguments

  • $name string - <p>the immutable name of an existing template</p>

delete

\struct Mandrill_Templates::delete(string $name)

Delete a template

  • Visibility: public

Arguments

  • $name string - <p>the immutable name of an existing template</p>

getList

array Mandrill_Templates::getList(string $label)

Return a list of all the templates available to this user

  • Visibility: public

Arguments

  • $label string - <p>an optional label to filter the templates</p>

timeSeries

array Mandrill_Templates::timeSeries(string $name)

Return the recent history (hourly stats for the last 30 days) for a template

  • Visibility: public

Arguments

  • $name string - <p>the name of an existing template</p>

render

\struct Mandrill_Templates::render(string $template_name, array $template_content, array $merge_vars)

Inject content and optionally merge fields into a template, returning the HTML that results

  • Visibility: public

Arguments

  • $template_name string - <p>the immutable name of a template that exists in the user's account</p>
  • $template_content array - <p>an array of template content to render. Each item in the array should be a struct with two keys - name: the name of the content block to set the content for, and content: the actual content to put into the block</p> <ul> <li>template_content[] struct the injection of a single piece of content into a single editable region <ul> <li>name string the name of the mc:edit editable region to inject into</li> <li>content string the content to inject</li> </ul></li> </ul>
  • $merge_vars array - <p>optional merge variables to use for injecting merge field content. If this is not provided, no merge fields will be replaced.</p> <ul> <li>merge_vars[] struct a single merge variable <ul> <li>name string the merge variable's name. Merge variable names are case-insensitive and may not start with _</li> <li>content string the merge variable's content</li> </ul></li> </ul>
Clone this wiki locally