model/modx/mail/modphpmailer.class.php
- package
- modx
- subpackage
- Classes
- modPHPMailer
Description
This file contains the PHPMailer implementation of the modMail email service.
\modPHPMailer
- Extends from
- \modMail
- package
- modx
- Methods
- __construct
- _getMailer
- address
- attach
- clearAttachments
- header
- reset
- send
- set
- setHTML
Description
PHPMailer implementation of the modMail service.
Methods
__construct
__construct(
\modX $modx, array $attributes
=
array
)
:
\modPHPMailer
Constructs a new instance of the modPHPMailer class.
Arguments
- $modx
- \modX
A reference to the modX instance - $attributes
- array
An array of attributes for the instance
Output
Details
- visibility
- public
- final
- false
- static
- false
_getMailer
_getMailer(
)
:
boolean
Loads the PHPMailer object used to send the emails in this implementation.
{@internal Implement this function in derivatives and call it in the constructor after all other dependencies have been satisfied.}
Output
- boolean
- True if the mailer class was successfully loaded
Details
- visibility
- protected
- final
- false
- static
- false
address
address(
string $type, string $email, string $name
)
:
boolean
Adds an address to the mailer
Arguments
- $type
- string
The type of address (to, reply-to, bcc, cc) - string
The email address to address to - $name
- string
The name of the email address
Output
- boolean
- True if was addressed
Details
- visibility
- public
- final
- false
- static
- false
attach
attach(
mixed $file, string $name, string $encoding
=
base64, string $type
=
application/octet-stream
)
:
Attaches a file to the mailer.
Arguments
- $file
- mixed
The file to attach - $name
- string
The name of the file to attach as - $encoding
- string
The encoding of the attachment - $type
- string
The header type of the attachment
Details
- visibility
- public
- final
- false
- static
- false
clearAttachments
clearAttachments(
)
:
Clears all existing attachments.
Details
- visibility
- public
- final
- false
- static
- false
header
header(
string $header
)
:
boolean
Adds a custom header to the mailer
Arguments
- $header
- string
The header to set
Output
- boolean
- True if the header was successfully set
Details
- visibility
- public
- final
- false
- static
- false
reset
reset(
array $attributes
=
array
)
:
Resets all PHPMailer attributes, including recipients and attachments.
Arguments
- $attributes
- array
An array of attributes to pass when resetting
Details
- visibility
- public
- final
- false
- static
- false
send
send(
array $attributes
=
array
)
:
boolean
Send the email, applying any attributes to the mailer before sending.
{@internal You should implement the rest of this method in a derivative class.}
Arguments
- $attributes
- array
An array of attributes to pass when sending
Output
- boolean
- True if the email was successfully sent
Details
- visibility
- public
- final
- false
- static
- false
set
set(
string $key, mixed $value
)
:
Sets a PHPMailer attribute corresponding to the modX::MAIL_* constants or a custom key.
{@internal Override this method in a derivative to set the appropriate attributes of the actual mailer implementation being used. Make sure to call this parent implementation first and then set the value of the corresponding mailer attribute as a reference to the attribute set in $this->attributes}
Arguments
- $key
- string
The attribute key to set - $value
- mixed
The value to set
Details
- visibility
- public
- final
- false
- static
- false
setHTML
setHTML(
boolean $toggle
)
:
Sets email to HTML or text-only.
Arguments
- $toggle
- boolean
True to set to HTML.
Details
- visibility
- public
- final
- false
- static
- false
- access
- public