PHP Class Pimcore\Mail

Inheritance: extends Zend_Mail
Mostrar archivo Open project: pimcore/pimcore Class Usage Examples

Public Properties

Property Type Description
$forcePimcoreMode boolean forces the mail class to always us the "Pimcore Mode", so you don't have to set the charset every time when you create new Pimcore_Mail instance

Protected Properties

Property Type Description
$debugEmailAddresses array Contains the debug email addresses from settings -> system -> Email Settings -> Debug email addresses
$document Pimcore\Model\Document\Email Contains the email document
$enableLayoutOnPlaceholderRendering boolean if true - the layout is enabled when document is rendered to a string
$hostUrl null if $hostUrl is set - this url well be used to create absolute urls otherwise it is determined automatically
$html2textBinaryEnabled boolean use html2text from mbayer if it is installed (http://www.mbayer.de/html2text/)
$html2textInstalled boolean html2text from mbayer is installed (http://www.mbayer.de/html2text/)
$html2textOptions string Options passed to html2text
$ignoreDebugMode boolean if true - the Pimcore debug mode is ignored
$loggingEnable boolean If true - emails are logged in the database and on the file-system
$params array Contains the dynamic Params for the Placeholders
$placeholderObject Pimcore_Placeholder
$preventDebugInformationAppending boolean Prevent adding debug information
$recipientsCleared boolean
$temporaryStorage array Contains data that has to be stored temporary e.g. email receivers for logging

Public Methods

Method Description
__construct ( null $charset = null )
addBcc ( string | array $email ) : Mail Adds Bcc recipient, $email can be an array, or a single string address Additionally adds recipients to temporary storage
addCc ( string | array $email, string $name = '' ) : Pimcore_Mail Adds Cc-header and recipient, $email can be an array, or a single string address Additionally adds recipients to temporary storage
addTo ( string | array $email, string $name = '' ) : Mail Adds To-header and recipient, $email can be an array, or a single string address Additionally adds recipients to temporary storage
clearRecipients ( ) : Mail Clears list of recipient email addresses and resets the temporary storage
determineHtml2TextIsInstalled ( ) : boolean Determines if mbayer html2text is installed (more information at http://www.mbayer.de/html2text/) and uses it to automatically create a text version of the html email
disableLogging ( ) : Mail Disables email logging
enableHtml2textBinary ( )
enableLogging ( ) : Mail Enables email logging (by default it's enabled)
getBodyHtmlRendered ( ) : string | null Replaces the placeholders with the content and returns the rendered Html
getBodyTextRendered ( ) : string Replaces the placeholders with the content and returns the rendered text if a text was set with "$mail->setBodyText()" *
getDocument ( ) : Email Returns the Document
getEnableLayoutOnPlaceholderRendering ( ) : boolean
getHostUrl ( ) : null
getHtml2TextBinaryEnabled ( ) : boolean
getHtml2TextOptions ( ) : string Returns options for html2text
getHtml2textInstalled ( ) : boolean
getIgnoreDebugMode ( ) : boolean Checks if the Debug mode is ignored
getParam ( string | integer $key ) : mixed Returns a parameter which was set with "setParams" or "setParam"
getParams ( ) : array Returns the parameters which were set with "setParams" or "setParam"
getSubjectRendered ( ) : string Replaces the placeholders with the content and returns the rendered Subject
getTemporaryStorage ( ) : array Returns the temporary storage
init ( $type = "email" ) : void Initializes the mailer with the settings form Settings -> System -> Email Settings
isValidEmailAddress ( $emailAddress ) : boolean Static helper to validate a email address
loggingIsEnabled ( ) : boolean returns the logging status
preventDebugInformationAppending ( ) : Mail Prevents appending of debug information (used for resending emails)
send ( Zend_Mail_Transport_Abstract $transport = null ) : Mail Sends this email using the given transport or with the settings from "Settings" -> "System" -> "Email Settings"
sendWithoutRendering ( null $transport = null ) : Zend_Mail sends mail without (re)rendering the content.
setDocument ( $document )
setEnableLayoutOnPlaceholderRendering ( $value )
setFrom ( string $email, null $name = null ) : Zend_Mail
setHostUrl ( $url )
setHtml2TextOptions ( string $options = '' ) : Mail Sets options that are passed to html2text
setIgnoreDebugMode ( $value )
setParam ( string | integer $key, mixed $value ) : Mail Sets a single parameter for the email view and the Placeholders
setParams ( array $params ) : Mail Sets the parameters for the email view and the Placeholders
setSender ( string $email ) : Zend_Mail Sets From-header and sender of the message
setTo ( $email, $name = '' )
unsetParam ( string | integer $key ) : Mail Deletes a single parameter which was set with "setParams" or "setParam"
unsetParams ( array $params ) : Mail Deletes parameters which were set with "setParams" or "setParam"

Protected Methods

Method Description
addToTemporaryStorage ( string $key, string | array $email, string $name ) Helper to add receivers to the temporary storage
checkDebugMode ( )
html2Text ( $htmlContent ) : string
setDocumentSettings ( ) : Mail Sets the settings which are defined in the Document Settings (from,to,cc,bcc)

Method Details

__construct() public method

public __construct ( null $charset = null )
$charset null

addBcc() public method

Adds Bcc recipient, $email can be an array, or a single string address Additionally adds recipients to temporary storage
public addBcc ( string | array $email ) : Mail
$email string | array
return Mail Provides fluent interface

addCc() public method

Adds Cc-header and recipient, $email can be an array, or a single string address Additionally adds recipients to temporary storage
public addCc ( string | array $email, string $name = '' ) : Pimcore_Mail
$email string | array
$name string
return Pimcore_Mail Provides fluent interface

addTo() public method

Adds To-header and recipient, $email can be an array, or a single string address Additionally adds recipients to temporary storage
public addTo ( string | array $email, string $name = '' ) : Mail
$email string | array
$name string
return Mail Provides fluent interface

addToTemporaryStorage() protected method

Helper to add receivers to the temporary storage
protected addToTemporaryStorage ( string $key, string | array $email, string $name )
$key string
$email string | array
$name string

checkDebugMode() protected method

protected checkDebugMode ( )

clearRecipients() public method

Clears list of recipient email addresses and resets the temporary storage
public clearRecipients ( ) : Mail
return Mail Provides fluent interface

determineHtml2TextIsInstalled() public static method

Determines if mbayer html2text is installed (more information at http://www.mbayer.de/html2text/) and uses it to automatically create a text version of the html email
public static determineHtml2TextIsInstalled ( ) : boolean
return boolean

disableLogging() public method

Disables email logging
public disableLogging ( ) : Mail
return Mail Provides fluent interface

enableHtml2textBinary() public method

enableLogging() public method

Enables email logging (by default it's enabled)
public enableLogging ( ) : Mail
return Mail Provides fluent interface

getBodyHtmlRendered() public method

Replaces the placeholders with the content and returns the rendered Html
public getBodyHtmlRendered ( ) : string | null
return string | null

getBodyTextRendered() public method

Replaces the placeholders with the content and returns the rendered text if a text was set with "$mail->setBodyText()" *
public getBodyTextRendered ( ) : string
return string

getDocument() public method

Returns the Document
public getDocument ( ) : Email
return Pimcore\Model\Document\Email | null

getEnableLayoutOnPlaceholderRendering() public method

getHostUrl() public method

public getHostUrl ( ) : null
return null

getHtml2TextBinaryEnabled() public method

getHtml2TextOptions() public method

Returns options for html2text
public getHtml2TextOptions ( ) : string
return string

getHtml2textInstalled() public static method

public static getHtml2textInstalled ( ) : boolean
return boolean || null

getIgnoreDebugMode() public method

Checks if the Debug mode is ignored
public getIgnoreDebugMode ( ) : boolean
return boolean

getParam() public method

Returns a parameter which was set with "setParams" or "setParam"
public getParam ( string | integer $key ) : mixed
$key string | integer
return mixed

getParams() public method

Returns the parameters which were set with "setParams" or "setParam"
public getParams ( ) : array
return array

getSubjectRendered() public method

Replaces the placeholders with the content and returns the rendered Subject
public getSubjectRendered ( ) : string
return string

getTemporaryStorage() public method

Returns the temporary storage
public getTemporaryStorage ( ) : array
return array

html2Text() protected method

protected html2Text ( $htmlContent ) : string
$htmlContent
return string

init() public method

Initializes the mailer with the settings form Settings -> System -> Email Settings
public init ( $type = "email" ) : void
return void

isValidEmailAddress() public static method

Static helper to validate a email address
public static isValidEmailAddress ( $emailAddress ) : boolean
$emailAddress
return boolean

loggingIsEnabled() public method

returns the logging status
public loggingIsEnabled ( ) : boolean
return boolean

preventDebugInformationAppending() public method

Prevents appending of debug information (used for resending emails)
public preventDebugInformationAppending ( ) : Mail
return Mail

send() public method

IMPORTANT: If the debug mode is enabled in "Settings" -> "System" -> "Debug" all emails will be sent to the debug email addresses that are given in "Settings" -> "System" -> "Email Settings" -> "Debug email addresses" set DefaultTransport or the internal mail function if no default transport had been set.
public send ( Zend_Mail_Transport_Abstract $transport = null ) : Mail
$transport Zend_Mail_Transport_Abstract
return Mail Provides fluent interface

sendWithoutRendering() public method

see also comments of send() method
public sendWithoutRendering ( null $transport = null ) : Zend_Mail
$transport null
return Zend_Mail

setDocument() public method

public setDocument ( $document )
$document

setDocumentSettings() protected method

Sets the settings which are defined in the Document Settings (from,to,cc,bcc)
protected setDocumentSettings ( ) : Mail
return Mail Provides fluent interface

setEnableLayoutOnPlaceholderRendering() public method

public setEnableLayoutOnPlaceholderRendering ( $value )
$value

setFrom() public method

public setFrom ( string $email, null $name = null ) : Zend_Mail
$email string
$name null
return Zend_Mail

setHostUrl() public method

public setHostUrl ( $url )
$url

setHtml2TextOptions() public method

Sets options that are passed to html2text
public setHtml2TextOptions ( string $options = '' ) : Mail
$options string
return Mail

setIgnoreDebugMode() public method

public setIgnoreDebugMode ( $value )
$value

setParam() public method

Sets a single parameter for the email view and the Placeholders
public setParam ( string | integer $key, mixed $value ) : Mail
$key string | integer
$value mixed
return Mail Provides fluent interface

setParams() public method

Sets the parameters for the email view and the Placeholders
public setParams ( array $params ) : Mail
$params array
return Mail Provides fluent interface

setSender() public method

Sets From-header and sender of the message
public setSender ( string $email ) : Zend_Mail
$email string
return Zend_Mail Provides fluent interface

setTo() public method

public setTo ( $email, $name = '' )

unsetParam() public method

Deletes a single parameter which was set with "setParams" or "setParam"
public unsetParam ( string | integer $key ) : Mail
$key string | integer
return Mail Provides fluent interface

unsetParams() public method

Deletes parameters which were set with "setParams" or "setParam"
public unsetParams ( array $params ) : Mail
$params array
return Mail Provides fluent interface

Property Details

$debugEmailAddresses protected_oe static_oe property

Contains the debug email addresses from settings -> system -> Email Settings -> Debug email addresses
protected static array $debugEmailAddresses
return array

$document protected_oe property

Contains the email document
protected Email,Pimcore\Model\Document $document
return Pimcore\Model\Document\Email

$enableLayoutOnPlaceholderRendering protected_oe property

if true - the layout is enabled when document is rendered to a string
protected bool $enableLayoutOnPlaceholderRendering
return boolean

$forcePimcoreMode public_oe static_oe property

forces the mail class to always us the "Pimcore Mode", so you don't have to set the charset every time when you create new Pimcore_Mail instance
public static bool $forcePimcoreMode
return boolean

$hostUrl protected_oe property

if $hostUrl is set - this url well be used to create absolute urls otherwise it is determined automatically
See also: MailHelper::setAbsolutePaths()
protected null $hostUrl
return null

$html2textBinaryEnabled protected_oe property

use html2text from mbayer if it is installed (http://www.mbayer.de/html2text/)
protected bool $html2textBinaryEnabled
return boolean

$html2textInstalled protected_oe static_oe property

html2text from mbayer is installed (http://www.mbayer.de/html2text/)
protected static bool $html2textInstalled
return boolean

$html2textOptions protected_oe property

Options passed to html2text
protected string $html2textOptions
return string

$ignoreDebugMode protected_oe property

if true - the Pimcore debug mode is ignored
protected bool $ignoreDebugMode
return boolean

$loggingEnable protected_oe property

If true - emails are logged in the database and on the file-system
protected bool $loggingEnable
return boolean

$params protected_oe property

Contains the dynamic Params for the Placeholders
protected array $params
return array

$placeholderObject protected_oe property

Pimcore_Placeholder
protected $placeholderObject

$preventDebugInformationAppending protected_oe property

Prevent adding debug information
protected bool $preventDebugInformationAppending
return boolean

$recipientsCleared protected_oe property

protected bool $recipientsCleared
return boolean

$temporaryStorage protected_oe property

Contains data that has to be stored temporary e.g. email receivers for logging
protected array $temporaryStorage
return array