Mailer
- Full name:
\Qubus\Mail\Mailer
- Parent interfaces:
\Qubus\Mail\Headers
,\Qubus\Mail\Addresses
,\Qubus\Mail\Transport
Methods
withHtml
Sets message type to HTML or plaintext.
Parameters:
Parameter | Type | Description |
---|---|---|
$isHtml | bool | True for HTML mode. |
withAttachment
Add an attachment from a path on the filesystem.
public withAttachment(string $path, string $name = '', string $encode = PHPMailer::ENCODING_BASE64, string $type = '', string $disposition = 'attachment'): static
Parameters:
Parameter | Type | Description |
---|---|---|
$path | string | Path to the attachment |
$name | string | Overrides the attachment name |
$encode | string | File encoding (see $Encoding) |
$type | string | MIME type, e.g. image/jpeg ; determined automatically from $path if not specified |
$disposition | string | Disposition to use. |
Throws:
withBody
Set Mail Body configuration
Format email message Body, this can be an external template html file with a copy of a plain-text like template.txt or HTML/plain-text string.
This method can be used by passing a template file HTML name and an associative array with the values that can be parsed into the file HTML by the key KEY_NAME found in your array to your HTML {{KEY_NAME}}.
Other optional ways to format the mail body is available like instead of a template the param $data can be set as an array or string, but param $options['template_name'] must be equal to null.
Parameters:
Parameter | Type | Description |
---|---|---|
$data | array|string | Contain the values to be parsed in mail body. |
$options | array | Array of options. |
withAltBody
The plain-text message body.
Parameters:
Parameter | Type | Description |
---|---|---|
$message | string |
save
Save message as eml file.
Return Value:
True if saved successfully, false otherwise.
Throws:
send
Create a message and send it.
Uses the sending method specified by $Mailer.
Return Value:
false on error.
Throws:
Inherited methods
withSmtp
Send messages using SMTP.
Throws:
withMail
Send messages using PHP's native mail() function.
withSendmail
Send messages using Sendmail.
withQmail
Send messages using qmail.
withFrom
Set the From and FromName properties.
Parameters:
Parameter | Type | Description |
---|---|---|
$address | string | |
$name | string | |
$auto | bool | Whether to also set the Sender address, defaults to true. |
Throws:
withTo
Add a "To" address.
Parameters:
Parameter | Type | Description |
---|---|---|
$address | string|array | The email address(es) to send to. |
Throws:
withCc
Add a "CC" address.
Parameters:
Parameter | Type | Description |
---|---|---|
$address | string|array | The email address(es) to send to. |
Throws:
withBcc
Add a "BCC" address.
Parameters:
Parameter | Type | Description |
---|---|---|
$address | string|array | The email address(es) to send to. |
Throws:
withReplyTo
Add a "Reply-To" address.
Parameters:
Parameter | Type | Description |
---|---|---|
$address | string|array | The email address(es) to reply to. |
Throws:
withSender
The envelope sender of the message.
This will usually be turned into a Return-Path header by the receiver, and is the address that bounces will be sent to.
Parameters:
Parameter | Type | Description |
---|---|---|
$sender | string |
withSubject
The Subject of the message.
Parameters:
Parameter | Type | Description |
---|---|---|
$subject | string |
withPriority
Email priority.
Options: null (default), 1 = High, 3 = Normal, 5 = low. When null, the header is not set at all.
Parameters:
Parameter | Type | Description |
---|---|---|
$priority | int|null |
withCharset
The character set of the message.
Parameters:
Parameter | Type | Description |
---|---|---|
$charset | string | The character set of the message. |
withCustomHeader
Add a custom header.
$name value can be overloaded to contain both header name and value (name:value).
Parameters:
Parameter | Type | Description |
---|---|---|
$name | string | Custom header name. |
$value | string|null | Header value. |
Throws:
withContentType
The MIME Content-type of the message.
Parameters:
Parameter | Type | Description |
---|---|---|
$contentType | string |
withXMailer
What to put in the X-Mailer header.
Options: An empty string for PHPMailer default, whitespace/null for none, or a string to use.
Parameters:
Parameter | Type | Description |
---|---|---|
$xmailer | string|null |
Automatically generated on 2025-10-13