# 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

| Type | Name | Description |
|  --- | --- | --- |
| `` | `$unique` |  |
| `` | `$temporaryAttachments` | This is not stored in DB, and is used to transmit information about mass mail attachments that are stored separately from template attachments |


## Methods

### __toString

```php
public function __toString()
```

Represent a mail template by its name.

### scopeMaster

```php
public function scopeMaster($query)
```

Retrieve "master" mail templates.

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

**Parameters**

| Type | Name | Description |
|  --- | --- | --- |
| `Builder` | `$query` |  |


**Returns** `Builder`

### scopeDomain

```php
public function scopeDomain($query)
```

### scopeName

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

### getActiveLanguages

```php
public static function getActiveLanguages()
```

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

**Returns** `\Illuminate\Database\Eloquent\Collection`

### boot

```php
public static function boot()
```

### toArray

```php
public function toArray(): array
```

### factoryFromArray

```php
public static function factoryFromArray(array $templateData): Template
```