Message
in package
implements
Stringable
Class Message.
Interfaces, Classes, Traits and Enums
- Stringable
Table of Contents
- $attachments : array<string|int, mixed>
- A list of attachments with Content-Disposition equals `attachment`.
- $bcc : array<string|int, mixed>
- An associative array used in the `Bcc` header.
- $boundary : string
- The message boundary.
- $cc : array<string|int, mixed>
- An associative array used in the `Cc` header.
- $date : string|null
- The message Date.
- $from : array<string|int, mixed>
- The values used in the `From` header.
- $headers : array<string|int, mixed>
- $htmlMessage : string
- The HTML message.
- $inlineAttachments : array<string|int, mixed>
- An associative array of attachments with Content-Disposition equals `inline`.
- $mailer : Mailer
- The Mailer instance.
- $plainMessage : string
- The plain text message.
- $replyTo : array<string|int, mixed>
- An associative array used in the `Reply-To` header.
- $to : array<string|int, mixed>
- An associative array used in the `To` header.
- __toString() : string
- Render the Message as string.
- addAttachment() : static
- Add a filename to be attached.
- addBcc() : static
- Add address and name in the Bcc header.
- addCc() : static
- Add address and name in the Cc header.
- addReplyTo() : static
- Add address and name in the Reply-To header.
- addTo() : static
- Add address and name in the To header.
- getAttachments() : array<int, string>
- Get a lis of attachments.
- getBcc() : array<string, string|null>
- Get items of the Bcc header.
- getBoundary() : string
- Get the boundary.
- getCc() : array<string, string|null>
- Get items of the Cc header.
- getDate() : string|null
- Get the Date header.
- getFrom() : array<int, string|null>
- Get the From header items.
- getFromAddress() : string|null
- Get the email address of the From header.
- getFromName() : string|null
- Get the name of the From header.
- getHeader() : string|null
- Get a header.
- getHeaderLines() : array<int, string>
- Get header lines.
- getHeaders() : array<string, string>
- Get all headers set.
- getHtmlMessage() : string|null
- Get the text/html message.
- getInlineAttachments() : array<string, string>
- Get a lis of inline attachments.
- getPlainMessage() : string|null
- Get the text/plain message.
- getRecipients() : array<int, string>
- getReplyTo() : array<string, string|null>
- Get items of the Reply-To header.
- getSubject() : string|null
- Get the Subject header.
- getTo() : array<string, string|null>
- Get items of the To header.
- getXMailer() : string|null
- Get the X-Mailer header.
- getXPriority() : XPriority|null
- Get the X-Priority header.
- removeBcc() : static
- Remove all items of the Bcc header.
- removeCc() : static
- Remove all items of the Cc header.
- removeFrom() : static
- Remove all items of the From header.
- removeHeader() : static
- Remove a header.
- removeReplyTo() : static
- Remove all items of the Reply-To header.
- removeTo() : static
- Remove all items of the To header.
- setBoundary() : static
- Set the boundary.
- setDate() : static
- Set the Date header.
- setFrom() : static
- Set the From header.
- setHeader() : static
- Set a header.
- setHtmlMessage() : static
- Set the text/html message.
- setInlineAttachment() : static
- Set a filename to be attached inline (image).
- setMailer() : static
- Set the Mailer instance.
- setPlainMessage() : static
- Set the text/plain message.
- setSubject() : static
- Set the Subject header.
- setXMailer() : static
- Set the X-Mailer header.
- setXPriority() : static
- Set the X-Priority header.
- formatAddress() : string
- formatAddressList() : string
- getCharset() : string
- getContentType() : string
- getCrlf() : string
- prepareHeaders() : void
- renderAttachments() : string
- renderData() : string
- renderHeaders() : string
- renderHtmlMessage() : string|null
- renderInlineAttachments() : string
- renderMessage() : string
- renderPlainMessage() : string|null
Properties
$attachments
A list of attachments with Content-Disposition equals `attachment`.
protected
array<string|int, mixed>
$attachments
= []
The filenames
$bcc
An associative array used in the `Bcc` header.
protected
array<string|int, mixed>
$bcc
= []
The email addresses as keys and the optional name as values
$boundary
The message boundary.
protected
string
$boundary
$cc
An associative array used in the `Cc` header.
protected
array<string|int, mixed>
$cc
= []
The email addresses as keys and the optional name as values
$date
The message Date.
protected
string|null
$date
= null
$from
The values used in the `From` header.
protected
array<string|int, mixed>
$from
= []
The email address as in the index 0 and the optional name in the index 1
$headers
protected
array<string|int, mixed>
$headers
= ['mime-version' => '1.0']
$htmlMessage
The HTML message.
protected
string
$htmlMessage
$inlineAttachments
An associative array of attachments with Content-Disposition equals `inline`.
protected
array<string|int, mixed>
$inlineAttachments
= []
The Content-ID's as keys and the filenames as values
$mailer
The Mailer instance.
protected
Mailer
$mailer
$plainMessage
The plain text message.
protected
string
$plainMessage
$replyTo
An associative array used in the `Reply-To` header.
protected
array<string|int, mixed>
$replyTo
= []
The email addresses as keys and the optional name as values
$to
An associative array used in the `To` header.
protected
array<string|int, mixed>
$to
= []
The email addresses as keys and the optional name as values
Methods
__toString()
Render the Message as string.
public
__toString() : string
Return values
string —addAttachment()
Add a filename to be attached.
public
addAttachment(string $filename) : static
Parameters
- $filename : string
-
The filename
Return values
static —addBcc()
Add address and name in the Bcc header.
public
addBcc(string $address[, string|null $name = null ]) : static
Parameters
- $address : string
-
The email address
- $name : string|null = null
-
The name or null to don't set
Return values
static —addCc()
Add address and name in the Cc header.
public
addCc(string $address[, string|null $name = null ]) : static
Parameters
- $address : string
-
The email address
- $name : string|null = null
-
The name or null to don't set
Return values
static —addReplyTo()
Add address and name in the Reply-To header.
public
addReplyTo(string $address[, string|null $name = null ]) : static
Parameters
- $address : string
-
The email address
- $name : string|null = null
-
The name or null to don't set
Return values
static —addTo()
Add address and name in the To header.
public
addTo(string $address[, string|null $name = null ]) : static
Parameters
- $address : string
-
The email address
- $name : string|null = null
-
The name or null to don't set
Return values
static —getAttachments()
Get a lis of attachments.
public
getAttachments() : array<int, string>
Return values
array<int, string> —Array of filenames
getBcc()
Get items of the Bcc header.
public
getBcc() : array<string, string|null>
Return values
array<string, string|null> —Emails as keys and names as values
getBoundary()
Get the boundary.
public
getBoundary() : string
Tags
Return values
string —getCc()
Get items of the Cc header.
public
getCc() : array<string, string|null>
Return values
array<string, string|null> —Emails as keys and names as values
getDate()
Get the Date header.
public
getDate() : string|null
Return values
string|null —The header value or null if not set
getFrom()
Get the From header items.
public
getFrom() : array<int, string|null>
Return values
array<int, string|null> —email address in key 0 and name in key 1
getFromAddress()
Get the email address of the From header.
public
getFromAddress() : string|null
Return values
string|null —The email or null if not set
getFromName()
Get the name of the From header.
public
getFromName() : string|null
Return values
string|null —The name or null if not set
getHeader()
Get a header.
public
getHeader(string $name) : string|null
Parameters
- $name : string
-
The header name
Return values
string|null —The header value or null if not set
getHeaderLines()
Get header lines.
public
getHeaderLines() : array<int, string>
Return values
array<int, string> —The header lines
getHeaders()
Get all headers set.
public
getHeaders() : array<string, string>
Return values
array<string, string> —The header names, in lowercase, as keys and the values as values
getHtmlMessage()
Get the text/html message.
public
getHtmlMessage() : string|null
Return values
string|null —The text/html message or null if not set
getInlineAttachments()
Get a lis of inline attachments.
public
getInlineAttachments() : array<string, string>
Return values
array<string, string> —Content-IDs as keys and filenames as values
getPlainMessage()
Get the text/plain message.
public
getPlainMessage() : string|null
Return values
string|null —The message or null if not set
getRecipients()
public
getRecipients() : array<int, string>
Return values
array<int, string> —getReplyTo()
Get items of the Reply-To header.
public
getReplyTo() : array<string, string|null>
Return values
array<string, string|null> —Emails as keys and names as values
getSubject()
Get the Subject header.
public
getSubject() : string|null
Return values
string|null —The header value or null if not set
getTo()
Get items of the To header.
public
getTo() : array<string, string|null>
Return values
array<string, string|null> —Emails as keys and names as values
getXMailer()
Get the X-Mailer header.
public
getXMailer() : string|null
Return values
string|null —The X-Mailer header or null
getXPriority()
Get the X-Priority header.
public
getXPriority() : XPriority|null
Return values
XPriority|null —The XPriority case or null
removeBcc()
Remove all items of the Bcc header.
public
removeBcc() : static
Return values
static —removeCc()
Remove all items of the Cc header.
public
removeCc() : static
Return values
static —removeFrom()
Remove all items of the From header.
public
removeFrom() : static
Return values
static —removeHeader()
Remove a header.
public
removeHeader(string $name) : static
Parameters
- $name : string
-
The header name
Return values
static —removeReplyTo()
Remove all items of the Reply-To header.
public
removeReplyTo() : static
Return values
static —removeTo()
Remove all items of the To header.
public
removeTo() : static
Return values
static —setBoundary()
Set the boundary.
public
setBoundary([string|null $boundary = null ]) : static
Parameters
- $boundary : string|null = null
Tags
Return values
static —setDate()
Set the Date header.
public
setDate([DateTime|null $datetime = null ]) : static
Parameters
- $datetime : DateTime|null = null
-
A custom DateTime or null to set the current datetime
Return values
static —setFrom()
Set the From header.
public
setFrom(string $address[, string|null $name = null ]) : static
Parameters
- $address : string
-
The email address
- $name : string|null = null
-
The name or null to don't set
Return values
static —setHeader()
Set a header.
public
setHeader(string $name, string $value) : static
Parameters
- $name : string
-
The header name
- $value : string
-
The header value
Return values
static —setHtmlMessage()
Set the text/html message.
public
setHtmlMessage(string $message) : static
Parameters
- $message : string
-
The text/html message
Return values
static —setInlineAttachment()
Set a filename to be attached inline (image).
public
setInlineAttachment(string $filename, string $cid) : static
Parameters
- $filename : string
-
The filename
- $cid : string
-
The Content-ID
Return values
static —setMailer()
Set the Mailer instance.
public
setMailer(Mailer $mailer) : static
Parameters
- $mailer : Mailer
-
The Mailer instance
Return values
static —setPlainMessage()
Set the text/plain message.
public
setPlainMessage(string $message) : static
Parameters
- $message : string
-
The text/plain message
Return values
static —setSubject()
Set the Subject header.
public
setSubject(string $subject) : static
Parameters
- $subject : string
-
The header value
Return values
static —setXMailer()
Set the X-Mailer header.
public
setXMailer([string|null $xMailer = null ]) : static
Parameters
- $xMailer : string|null = null
-
The X-Mailer header or null to set the default
Return values
static —setXPriority()
Set the X-Priority header.
public
setXPriority(XPriority $priority) : static
Parameters
Return values
static —formatAddress()
protected
static formatAddress(string $address[, string|null $name = null ]) : string
Parameters
- $address : string
- $name : string|null = null
Return values
string —formatAddressList()
protected
static formatAddressList(array<string, string|null> $addresses) : string
Parameters
- $addresses : array<string, string|null>
Return values
string —getCharset()
protected
getCharset() : string
Return values
string —getContentType()
protected
getContentType(string $filename) : string
Parameters
- $filename : string
Return values
string —getCrlf()
protected
getCrlf() : string
Return values
string —prepareHeaders()
protected
prepareHeaders() : void
Return values
void —renderAttachments()
protected
renderAttachments() : string
Return values
string —renderData()
protected
renderData() : string
Return values
string —renderHeaders()
protected
renderHeaders() : string
Return values
string —renderHtmlMessage()
protected
renderHtmlMessage() : string|null
Return values
string|null —renderInlineAttachments()
protected
renderInlineAttachments() : string
Return values
string —renderMessage()
protected
renderMessage(string $message[, string $contentType = 'text/html' ]) : string
Parameters
- $message : string
- $contentType : string = 'text/html'
Return values
string —renderPlainMessage()
protected
renderPlainMessage() : string|null