core/model/modx/mail/modphpmailer.class.php

Show: inherited
Table of Contents

This file contains the PHPMailer implementation of the modMail email service.

Package
modx  
Subpackage
mail  

\modPHPMailer

Package: modx\mail

PHPMailer implementation of the modMail service.

Parent(s)
\modMail

Constants

Constant  MAIL_BODY = 'mail_body'
inherited

Inherited from: \modMail::MAIL_BODY
Const
An option for setting the mail body  
Inherited_from
\modMail::MAIL_BODY  
Constant  MAIL_BODY_TEXT = 'mail_body_text'
inherited

Inherited from: \modMail::MAIL_BODY_TEXT
Const
An option for setting the mail body text  
Inherited_from
\modMail::MAIL_BODY_TEXT  
Constant  MAIL_CHARSET = 'mail_charset'
inherited

Inherited from: \modMail::MAIL_CHARSET
Const
An option for setting the mail charset  
Inherited_from
\modMail::MAIL_CHARSET  
Constant  MAIL_CONTENT_TYPE = 'mail_content_type'
inherited

Inherited from: \modMail::MAIL_CONTENT_TYPE
Const
An option for setting the mail content type  
Inherited_from
\modMail::MAIL_CONTENT_TYPE  
Constant  MAIL_ENCODING = 'mail_encoding'
inherited

Inherited from: \modMail::MAIL_ENCODING
Const
An option for setting the mail encoding  
Inherited_from
\modMail::MAIL_ENCODING  
Constant  MAIL_ENGINE = 'mail_engine'
inherited

Inherited from: \modMail::MAIL_ENGINE
Const
An option for setting the mail engine  
Inherited_from
\modMail::MAIL_ENGINE  
Constant  MAIL_ENGINE_PATH = 'mail_engine_path'
inherited

Inherited from: \modMail::MAIL_ENGINE_PATH
Const
An option for setting the mail engine path  
Inherited_from
\modMail::MAIL_ENGINE_PATH  
Constant  MAIL_ERROR_INFO = 'mail_error_info'
inherited

Inherited from: \modMail::MAIL_ERROR_INFO
Const
An option for setting the mail error information  
Inherited_from
\modMail::MAIL_ERROR_INFO  
Constant  MAIL_FROM = 'mail_from'
inherited

Inherited from: \modMail::MAIL_FROM
Const
An option for setting the mail From address  
Inherited_from
\modMail::MAIL_FROM  
Constant  MAIL_FROM_NAME = 'mail_from_name'
inherited

Inherited from: \modMail::MAIL_FROM_NAME
Const
An option for setting the mail From name  
Inherited_from
\modMail::MAIL_FROM_NAME  
Constant  MAIL_HOSTNAME = 'mail_hostname'
inherited

Inherited from: \modMail::MAIL_HOSTNAME
Const
An option for setting the mail hostname  
Inherited_from
\modMail::MAIL_HOSTNAME  
Constant  MAIL_LANGUAGE = 'mail_language'
inherited

Inherited from: \modMail::MAIL_LANGUAGE
Const
An option for setting the mail language  
Inherited_from
\modMail::MAIL_LANGUAGE  
Constant  MAIL_PRIORITY = 'mail_priority'
inherited

Inherited from: \modMail::MAIL_PRIORITY
Const
An option for setting the mail priority header  
Inherited_from
\modMail::MAIL_PRIORITY  
Constant  MAIL_READ_TO = 'mail_read_to'
inherited

Inherited from: \modMail::MAIL_READ_TO
Const
An option for setting the mail read to header  
Inherited_from
\modMail::MAIL_READ_TO  
Constant  MAIL_SENDER = 'mail_sender'
inherited

Inherited from: \modMail::MAIL_SENDER
Const
An option for setting the mail sender  
Inherited_from
\modMail::MAIL_SENDER  
Constant  MAIL_SERVICE = 'mail_service'
inherited

Inherited from: \modMail::MAIL_SERVICE
Const
An option for setting the mail service  
Inherited_from
\modMail::MAIL_SERVICE  
Constant  MAIL_SMTP_AUTH = 'mail_smtp_auth'
inherited

Inherited from: \modMail::MAIL_SMTP_AUTH
Const
An option for setting the mail SMTP auth type  
Inherited_from
\modMail::MAIL_SMTP_AUTH  
Constant  MAIL_SMTP_HELO = 'mail_smtp_helo'
inherited

Inherited from: \modMail::MAIL_SMTP_HELO
Const
An option for setting the mail SMTP HELO boolean  
Inherited_from
\modMail::MAIL_SMTP_HELO  
Constant  MAIL_SMTP_HOSTS = 'mail_smtp_hosts'
inherited

Inherited from: \modMail::MAIL_SMTP_HOSTS
Const
An option for setting the mail SMTP hosts  
Inherited_from
\modMail::MAIL_SMTP_HOSTS  
Constant  MAIL_SMTP_KEEPALIVE = 'mail_smtp_keepalive'
inherited

Inherited from: \modMail::MAIL_SMTP_KEEPALIVE
Const
An option for setting the mail SMTP Keep-Alive boolean  
Inherited_from
\modMail::MAIL_SMTP_KEEPALIVE  
Constant  MAIL_SMTP_PASS = 'mail_smtp_pass'
inherited

Inherited from: \modMail::MAIL_SMTP_PASS
Const
An option for setting the mail SMTP password  
Inherited_from
\modMail::MAIL_SMTP_PASS  
Constant  MAIL_SMTP_PORT = 'mail_smtp_port'
inherited

Inherited from: \modMail::MAIL_SMTP_PORT
Const
An option for setting the mail SMTP port  
Inherited_from
\modMail::MAIL_SMTP_PORT  
Constant  MAIL_SMTP_PREFIX = 'mail_smtp_prefix'
inherited

Inherited from: \modMail::MAIL_SMTP_PREFIX
Const
An option for setting the mail SMTP prefix  
Inherited_from
\modMail::MAIL_SMTP_PREFIX  
Constant  MAIL_SMTP_SINGLE_TO = 'mail_smtp_single_to'
inherited

Inherited from: \modMail::MAIL_SMTP_SINGLE_TO
Const
An option for setting the mail SMTP Single-To option  
Inherited_from
\modMail::MAIL_SMTP_SINGLE_TO  
Constant  MAIL_SMTP_TIMEOUT = 'mail_smtp_timeout'
inherited

Inherited from: \modMail::MAIL_SMTP_TIMEOUT
Const
An option for setting the mail SMTP timeout  
Inherited_from
\modMail::MAIL_SMTP_TIMEOUT  
Constant  MAIL_SMTP_USER = 'mail_smtp_user'
inherited

Inherited from: \modMail::MAIL_SMTP_USER
Const
An option for setting the mail SMTP username  
Inherited_from
\modMail::MAIL_SMTP_USER  
Constant  MAIL_SUBJECT = 'mail_subject'
inherited

Inherited from: \modMail::MAIL_SUBJECT
Const
An option for setting the mail subject  
Inherited_from
\modMail::MAIL_SUBJECT  

Properties

Propertypublicarray  $addresses= 'array( 'to' => array(), 'cc' => array(), 'bcc' => array(), 'reply-to' => array(), )'
inherited

An array of address types: to, cc, bcc, reply-to

Inherited from: \modMail::$$addresses
Default valuearray( 'to' => array(), 'cc' => array(), 'bcc' => array(), 'reply-to' => array(), )Details
Type
array
Inherited_from
\modMail::$$addresses  
Propertypublicarray  $attributes= 'array()'
inherited

A collection of attributes defining all of the details of email communication.

Inherited from: \modMail::$$attributes
Default valuearray()Details
Type
array
Inherited_from
\modMail::$$attributes  
Propertypublicarray  $files= 'array()'
inherited

An array of attached files

Inherited from: \modMail::$$files
Default valuearray()Details
Type
array
Inherited_from
\modMail::$$files  
Propertypublicarray  $headers= 'array()'
inherited

A collection of all the current headers for the object.

Inherited from: \modMail::$$headers
Default valuearray()Details
Type
array
Inherited_from
\modMail::$$headers  
Propertypublicobject  $mailer= 'null'
inherited

The mailer object responsible for implementing the modMail methods.

Inherited from: \modMail::$$mailer
Default valuenullDetails
Type
object
Inherited_from
\modMail::$$mailer  
Propertypublic\modX  $modx= 'null'
inherited

A reference to the modX instance communicating with this service instance.

Inherited from: \modMail::$$modx
Default valuenullDetails
Type
\modX
Inherited_from
\modMail::$$modx  

Methods

methodpublic__construct( \modX $modx, array $attributes = array() ) : \modPHPMailer

Constructs a new instance of the modPHPMailer class.

Parameters
Name Type Description
$modx \modX

A reference to the modX instance

$attributes array

An array of attributes for the instance

Returns
Type Description
\modPHPMailer
methodprotected_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.}

Returns
Type Description
boolean True if the mailer class was successfully loaded
methodpublicaddress( string $type, string $email, string $name = '' ) : boolean

Adds an address to the mailer

Parameters
Name Type Description
$type string

The type of address (to, reply-to, bcc, cc)

$email string

The email address to address to

$name string

The name of the email address

Returns
Type Description
boolean True if was addressed
methodpublicattach( mixed $file, string $name = '', string $encoding = 'base64', string $type = 'application/octet-stream' ) : void

Attaches a file to the mailer.

Parameters
Name Type Description
$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

methodpublicclearAttachments( ) : void

Clears all existing attachments.

methodpublicget( string $key ) : mixed
inherited

Gets a reference to an attribute of the mail object.

Inherited from: \modMail::get()
Parameters
Name Type Description
$key string

The attribute key.

Returns
Type Description
mixed A reference to the attribute, or null if no attribute value is set for the key.
Details
Access
public  
methodpublicgetDefaultAttributes( array $attributes = array() ) : array
inherited

Gets the default attributes for modMail based on system settings

Inherited from: \modMail::getDefaultAttributes()
Parameters
Name Type Description
$attributes array

An optional array of default attributes to override with

Returns
Type Description
array An array of default attributes
methodpublicheader( string $header ) : boolean

Adds a custom header to the mailer

Parameters
Name Type Description
$header string

The header to set

Returns
Type Description
boolean True if the header was successfully set
methodpublicreset( array $attributes = array() ) : void

Resets all PHPMailer attributes, including recipients and attachments.

Parameters
Name Type Description
$attributes array

An array of attributes to pass when resetting

methodpublicsend( 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.}

Parameters
Name Type Description
$attributes array

An array of attributes to pass when sending

Returns
Type Description
boolean True if the email was successfully sent
methodpublicset( string $key, mixed $value ) : void

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}

Parameters
Name Type Description
$key string

The attribute key to set

$value mixed

The value to set

methodpublicsetHTML( boolean $toggle ) : void

Sets email to HTML or text-only.

Parameters
Name Type Description
$toggle boolean

True to set to HTML.

Details
Access
public  
Documentation was generated by DocBlox 0.18.1.