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

Show: inherited
Table of Contents

This file contains the modMail email service interface definition.

Package
modx  
Subpackage
mail  

\modMail

Package: modx\mail

Defines the interface for the modX email service.

Children
\modPHPMailer
Abstract
Implement a derivative of this class to define an actual email service implementation.  

Constants

Constant  MAIL_BODY = 'mail_body'

Const
An option for setting the mail body  
Constant  MAIL_BODY_TEXT = 'mail_body_text'

Const
An option for setting the mail body text  
Constant  MAIL_CHARSET = 'mail_charset'

Const
An option for setting the mail charset  
Constant  MAIL_CONTENT_TYPE = 'mail_content_type'

Const
An option for setting the mail content type  
Constant  MAIL_ENCODING = 'mail_encoding'

Const
An option for setting the mail encoding  
Constant  MAIL_ENGINE = 'mail_engine'

Const
An option for setting the mail engine  
Constant  MAIL_ENGINE_PATH = 'mail_engine_path'

Const
An option for setting the mail engine path  
Constant  MAIL_ERROR_INFO = 'mail_error_info'

Const
An option for setting the mail error information  
Constant  MAIL_FROM = 'mail_from'

Const
An option for setting the mail From address  
Constant  MAIL_FROM_NAME = 'mail_from_name'

Const
An option for setting the mail From name  
Constant  MAIL_HOSTNAME = 'mail_hostname'

Const
An option for setting the mail hostname  
Constant  MAIL_LANGUAGE = 'mail_language'

Const
An option for setting the mail language  
Constant  MAIL_PRIORITY = 'mail_priority'

Const
An option for setting the mail priority header  
Constant  MAIL_READ_TO = 'mail_read_to'

Const
An option for setting the mail read to header  
Constant  MAIL_SENDER = 'mail_sender'

Const
An option for setting the mail sender  
Constant  MAIL_SERVICE = 'mail_service'

Const
An option for setting the mail service  
Constant  MAIL_SMTP_AUTH = 'mail_smtp_auth'

Const
An option for setting the mail SMTP auth type  
Constant  MAIL_SMTP_HELO = 'mail_smtp_helo'

Const
An option for setting the mail SMTP HELO boolean  
Constant  MAIL_SMTP_HOSTS = 'mail_smtp_hosts'

Const
An option for setting the mail SMTP hosts  
Constant  MAIL_SMTP_KEEPALIVE = 'mail_smtp_keepalive'

Const
An option for setting the mail SMTP Keep-Alive boolean  
Constant  MAIL_SMTP_PASS = 'mail_smtp_pass'

Const
An option for setting the mail SMTP password  
Constant  MAIL_SMTP_PORT = 'mail_smtp_port'

Const
An option for setting the mail SMTP port  
Constant  MAIL_SMTP_PREFIX = 'mail_smtp_prefix'

Const
An option for setting the mail SMTP prefix  
Constant  MAIL_SMTP_SINGLE_TO = 'mail_smtp_single_to'

Const
An option for setting the mail SMTP Single-To option  
Constant  MAIL_SMTP_TIMEOUT = 'mail_smtp_timeout'

Const
An option for setting the mail SMTP timeout  
Constant  MAIL_SMTP_USER = 'mail_smtp_user'

Const
An option for setting the mail SMTP username  
Constant  MAIL_SUBJECT = 'mail_subject'

Const
An option for setting the mail subject  

Properties

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

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

Default valuearray( 'to' => array(), 'cc' => array(), 'bcc' => array(), 'reply-to' => array(), )Details
Type
array
Propertypublicarray  $attributes= 'array()'

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

Default valuearray()Details
Type
array
Propertypublicarray  $files= 'array()'

An array of attached files

Default valuearray()Details
Type
array
Propertypublicarray  $headers= 'array()'

A collection of all the current headers for the object.

Default valuearray()Details
Type
array
Propertypublicobject  $mailer= 'null'

The mailer object responsible for implementing the modMail methods.

Default valuenullDetails
Type
object
Propertypublic\modX  $modx= 'null'

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

Default valuenullDetails
Type
\modX

Methods

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

Constructs a new instance of the modMail class.

Parameters
Name Type Description
$modx \modX

&$modx A reference to the modX instance

$attributes array

An array of attributes to assign to the new mail instance

methodprotected_getMailer( ) : boolean
abstract

Get an instance of the email class responsible for sending emails from the modEmail service.

{@internal Implement this function in derivatives and call it in the constructor after all other dependencies have been satisfied.}

Returns
Type Description
boolean Indicates if the mailer class was instantiated successfully.
Details
Abstract
 
Access
protected  
methodpublicaddress( string $type, string $email, string $name = '' ) : boolean

Add a new recipient email address to one of the valid address type buckets.

Parameters
Name Type Description
$type string

The address type to add; to, cc, bcc, or reply-to.

$email string

The email address.

$name string

An optional name for the addressee.

Returns
Type Description
boolean Indicates if the address was set/unset successfully.
Details
Access
public  
methodpublicattach( string $file ) : void

Attach a file to the attachments queue.

Parameters
Name Type Description
$file string

The absolute path to the file

Details
Access
public  
methodpublicclearAttachments( ) : void

Clear all existing attachments.

Details
Access
public  
methodpublicget( string $key ) : mixed

Gets a reference to an attribute of the mail object.

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

Gets the default attributes for modMail based on system settings

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 header to the mailer

Parameters
Name Type Description
$header string

The HTTP header to send.

Returns
Type Description
boolean True if the header is valid and is set.
Details
Access
public  
methodpublicreset( array $attributes = array() ) : void

Reset the mail service, clearing addresses and attributes.

Parameters
Name Type Description
$attributes array

An optional array of attributes to apply after reset.

Details
Access
public  
methodpublicsend( array $attributes = array() ) : boolean

Send an email setting any supplied attributes before sending.

{@internal You should implement the rest of this method in a derivative class.}

Parameters
Name Type Description
$attributes array

Attributes to override any existing attributes before sending.

Returns
Type Description
boolean Indicates if the email was sent successfully.
Details
Abstract
 
Access
public  
methodpublicset( string $key, mixed $value ) : void

Sets the value of an attribute of the mail object.

{@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 key of the attribute to set.

$value mixed

The value of the attribute.

Details
Abstract
 
Access
public  
Documentation was generated by DocBlox 0.18.1.