Skip to content
Last updated

WHMCS\Mail\Template

Class · extends AbstractModel

Functionality related to mail templates.

Emails sent by WHMCS are composed by Smarty templates stored in the database.

This object allows one to interact with an outgoing mail template. You can interact with the template's contents, edit the subject line, change it's type, or change it's name. Templates are identified in the product by their Unique ID or the type:name pair.

A disabled template specified for an outgoing email message will cause template processing to fail, and cause the email to not be sent.

Properties

TypeNameDescription
``$unique
``$temporaryAttachmentsThis is not stored in DB, and is used to transmit information about mass mail attachments that are stored separately from template attachments

Methods

__toString

public function __toString()

Represent a mail template by its name.

scopeMaster

public function scopeMaster($query)

Retrieve "master" mail templates.

A master mail template is a mail template with no defined language.

Parameters

TypeNameDescription
Builder$query

Returns Builder

scopeDomain

public function scopeDomain($query)

scopeName

public function scopeName(Builder $query, string $name)

getActiveLanguages

public static function getActiveLanguages()

Retrieve a list of all of the languages used by all mail templates.

Returns \Illuminate\Database\Eloquent\Collection

boot

public static function boot()

toArray

public function toArray(): array

factoryFromArray

public static function factoryFromArray(array $templateData): Template