Mailer
Mailer Class.
A basic wrapper for sending template-based emails.
Tags
Table of Contents
$logger | Logger | |
---|---|---|
$phpMailer | PHPMailer | |
__construct() | Create a new Mailer instance. | mixed |
getPhpMailer() | Get the underlying PHPMailer object. | PHPMailer |
send() | Send a MailMessage message. | mixed |
sendDistinct() | Send a MailMessage message, sending a separate email to each recipient. | mixed |
setOptions() | Set option(s) on the underlying phpMailer object. | Mailer |
Properties
$logger
protected
Logger
$logger
$phpMailer
protected
PHPMailer
$phpMailer
Methods
__construct()
Create a new Mailer instance.
public
__construct(
$logger :
Logger
[, $config :
array
= [] ]
)
: mixed
Parameters
- $logger : Logger
A Monolog logger, used to dump debugging info for SMTP server transactions.
- $config : array = []
An array of configuration parameters for phpMailer.
Tags
Return values
mixedgetPhpMailer()
Get the underlying PHPMailer object.
public
getPhpMailer(
)
: PHPMailer
Return values
PHPMailersend()
Send a MailMessage message.
public
send(
$message :
MailMessage
[, $clearRecipients :
bool
= true ]
)
: mixed
Sends a single email to all recipients, as well as their CCs and BCCs. Since it is a single-header message, recipient-specific template data will not be included.
Parameters
- $message : MailMessage
- $clearRecipients : bool = true
Set to true to clear the list of recipients in the message after calling send(). This helps avoid accidentally sending a message multiple times.
Tags
Return values
mixedsendDistinct()
Send a MailMessage message, sending a separate email to each recipient.
public
sendDistinct(
$message :
MailMessage
[, $clearRecipients :
bool
= true ]
)
: mixed
If the message object supports message templates, this will render the template with the corresponding placeholder values for each recipient.
Parameters
- $message : MailMessage
- $clearRecipients : bool = true
Set to true to clear the list of recipients in the message after calling send(). This helps avoid accidentally sending a message multiple times.
Tags
Return values
mixedsetOptions()
Set option(s) on the underlying phpMailer object.
public
setOptions(
$options :
array
)
: Mailer
Parameters
- $options : array