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.

class Template extends AbstractModel

Properties summary

Type Property Description
protected $table
protected $guarded
protected $booleans
protected $commaSeparated
$unique
int $id Unique ID number for this mail template.
string $type English language internal name describing email type, from this set: 'general', 'product', 'support', 'invoice'
string $name Name by which the template is known in the Admin interface.
string $subject Subject line that will be set in the outgoing email that uses this template.
string $message The message template used for the body of the outgoing email.
string[] $attachments Comma delimited list of filenames for files that should be attached to the outgoing email, with it's root at /downloads/
string $fromName Name which should be used as the "From" name displayed in the recipient's email client. If set to null, WHMCS uses the default.
string $fromEmail Email address which should be used as the "From" address in the recipient's email client. If set to null, WHMCS uses the default.
bool $disabled If set to true, this email template will not be used for outgoing email.
bool $custom False if the email template is a WHMCS built-in. True otherwise.
string $language English language internal name identifying the language of this email template translation.
string[] $copyTo Comma delimited list of email addresses that should be CC: on the outgoing email.
string[] $blindCopyTo Comma delimited list of email addresses that should be BCC: on the outgoing email.
bool $plaintext If set to true, this email will be sent without HTML body content, only plain text.
Carbon $createdAt
Carbon $updatedAt

Methods summary

Return Type Method Name Description
__toString() Represent a mail template by its name.
Builder scopeMaster(Builder $query) Retrieve "master" mail templates.
static Collection getActiveLanguages() Retrieve a list of all of the languages used by all mail templates.
static  boot() -

Details

__toString ()

Represent a mail template by its name.

Builder scopeMaster (Builder $query)

Retrieve "master" mail templates.

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

Parameters

Builder $query

Return Value

Builder

static Collection getActiveLanguages ()

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

Return Value

Collection

static boot ()