class Mail extends Swift_Message (View source)

Properties

static protected bool $forceDebugMode
static protected array $debugEmailAddresses Contains the debug email addresses from settings -> system -> Email Settings -> Debug email addresses
protected Placeholder $placeholderObject
protected bool $loggingEnable If true - emails are logged in the database and on the file-system
protected Email $document Contains the email document
protected array $params Contains the dynamic Params for the Placeholders
static protected bool $html2textInstalled html2text from mbayer is installed (http://www.mbayer.de/html2text/)
protected string $html2textOptions Options passed to html2text
protected bool $html2textBinaryEnabled use html2text from mbayer if it is installed (http://www.mbayer.de/html2text/)
protected bool $preventDebugInformationAppending Prevent adding debug information
protected bool $ignoreDebugMode if true - the Pimcore debug mode is ignored
protected bool $enableLayoutOnPlaceholderRendering if true - the layout is enabled when document is rendered to a string
static bool $forcePimcoreMode 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 null $hostUrl if $hostUrl is set - this url well be used to create absolute urls otherwise it is determined automatically
protected bool $recipientsCleared if true: prevent setting the recipients from the Document - set in $this->clearRecipients()
protected string $bodyText body plain text
protected Swift_MimePart $bodyTextMimePart plain text mime part this is created and attached to mail on send
protected array $originalData place to store original data before modifying message when sending in debug mode
protected Log $lastLogEntry

Methods

$this
setHostUrl($url)

No description

null
getHostUrl()

No description

__construct(null $subject = null, null $body = null, null $contentType = null, null $charset = null)

Mail constructor.

init(string $type = 'email')

Initializes the mailer with the settings form Settings -> System -> Email Settings

$this
setIgnoreDebugMode($value)

No description

bool
getIgnoreDebugMode()

Checks if the Debug mode is ignored

bool
doRedirectMailsToDebugMailAddresses()

returns if redirecting to debug mail addresses should take place when sending the mail

$this
setEnableLayoutOnPlaceholderRendering($value)

No description

static bool
determineHtml2TextIsInstalled()

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

setHtml2TextOptions(string $options = '')

Sets options that are passed to html2text

string
getHtml2TextOptions()

Returns options for html2text

clearRecipients()

Clears list of recipient email addresses

disableLogging()

Disables email logging

enableLogging()

Enables email logging (by default it's enabled)

bool
loggingIsEnabled()

returns the logging status

setParams(array $params)

Sets the parameters for the email view and the Placeholders

setParam(string $key, mixed $value)

Sets a single parameter for the email view and the Placeholders

array
getParams()

Returns the parameters which were set with "setParams" or "setParam"

mixed
getParam(string $key)

Returns a parameter which was set with "setParams" or "setParam"

static 
setForceDebugMode(bool $value)

Forces the debug mode - useful for cli-script which should not send emails to recipients

unsetParams(array $params)

Deletes parameters which were set with "setParams" or "setParam"

unsetParam(string $key)

Deletes a single parameter which was set with "setParams" or "setParam"

setDocumentSettings()

Sets the settings which are defined in the Document Settings (from,to,cc,bcc,replyTo)

send(Swift_Mailer $mailer = null)

Sends this email using the given transport or with the settings from "Settings" -> "System" -> "Email Settings"

sendWithoutRendering(Swift_Mailer $mailer = null)

sends mail without (re)rendering the content.

static bool
isValidEmailAddress($emailAddress)

Static helper to validate a email address

string
getSubjectRendered()

Replaces the placeholders with the content and returns the rendered Subject

string|null
getBodyHtmlRendered()

Replaces the placeholders with the content and returns the rendered Html

string
getBodyTextRendered()

Replaces the placeholders with the content and returns the rendered text if a text was set with "$mail->setBodyText()"

$this
setDocument($document)

No description

getDocument()

Returns the Document

preventDebugInformationAppending()

Prevents appending of debug information (used for resending emails)

bool
isPreventingDebugInformationAppending()

Returns, if debug information is not added

bool
getHtml2TextBinaryEnabled()

No description

$this
enableHtml2textBinary()

No description

static bool
getHtml2textInstalled()

No description

string
html2Text($htmlContent)

No description

string
getBodyText()

No description

$this
setBodyText($bodyText)

No description

setBodyHtml($body)

No description

Swift_MimePart
getBodyTextMimePart()

No description

array
getOriginalData()

No description

setOriginalData(array $originalData)

No description

$this
addAttachment(Swift_Mime_Attachment $attachment)

No description

Swift_Mime_Attachment
createAttachment($data, $mimeType = null, $filename = null, $disposition = null)

No description

addTo($address, $name = null)

No description

Log
getLastLogEntry()

No description

Details

$this setHostUrl($url)

Parameters

$url

Return Value

$this

null getHostUrl()

Return Value

null

__construct(null $subject = null, null $body = null, null $contentType = null, null $charset = null)

Mail constructor.

Parameters

null $subject
null $body
null $contentType
null $charset

init(string $type = 'email')

Initializes the mailer with the settings form Settings -> System -> Email Settings

Parameters

string $type

$this setIgnoreDebugMode($value)

Parameters

$value

Return Value

$this

bool getIgnoreDebugMode()

Checks if the Debug mode is ignored

Return Value

bool

bool doRedirectMailsToDebugMailAddresses()

returns if redirecting to debug mail addresses should take place when sending the mail

Return Value

bool

$this setEnableLayoutOnPlaceholderRendering($value)

Parameters

$value

Return Value

$this

bool getEnableLayoutOnPlaceholderRendering()

Return Value

bool

static bool determineHtml2TextIsInstalled()

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

Return Value

bool

Mail setHtml2TextOptions(string $options = '')

Sets options that are passed to html2text

Parameters

string $options

Return Value

Mail

string getHtml2TextOptions()

Returns options for html2text

Return Value

string

Mail clearRecipients()

Clears list of recipient email addresses

Return Value

Mail Provides fluent interface

Mail disableLogging()

Disables email logging

Return Value

Mail Provides fluent interface

Mail enableLogging()

Enables email logging (by default it's enabled)

Return Value

Mail Provides fluent interface

bool loggingIsEnabled()

returns the logging status

Return Value

bool

Mail setParams(array $params)

Sets the parameters for the email view and the Placeholders

Parameters

array $params

Return Value

Mail Provides fluent interface

Mail setParam(string $key, mixed $value)

Sets a single parameter for the email view and the Placeholders

Parameters

string $key | int $key
mixed $value

Return Value

Mail Provides fluent interface

array getParams()

Returns the parameters which were set with "setParams" or "setParam"

Return Value

array

mixed getParam(string $key)

Returns a parameter which was set with "setParams" or "setParam"

Parameters

string $key | integer $key

Return Value

mixed

static setForceDebugMode(bool $value)

Forces the debug mode - useful for cli-script which should not send emails to recipients

Parameters

bool $value

Mail unsetParams(array $params)

Deletes parameters which were set with "setParams" or "setParam"

Parameters

array $params

Return Value

Mail Provides fluent interface

Mail unsetParam(string $key)

Deletes a single parameter which was set with "setParams" or "setParam"

Parameters

string $key | integer $key

Return Value

Mail Provides fluent interface

protected Mail setDocumentSettings()

Sets the settings which are defined in the Document Settings (from,to,cc,bcc,replyTo)

Return Value

Mail Provides fluent interface

Mail send(Swift_Mailer $mailer = null)

Sends this email using the given transport or with the settings from "Settings" -> "System" -> "Email Settings"

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.

Parameters

Swift_Mailer $mailer

Return Value

Mail Provides fluent interface

Mail sendWithoutRendering(Swift_Mailer $mailer = null)

sends mail without (re)rendering the content.

see also comments of send() method

Parameters

Swift_Mailer $mailer

Return Value

Mail

static bool isValidEmailAddress($emailAddress)

Static helper to validate a email address

Parameters

$emailAddress

Return Value

bool

string getSubjectRendered()

Replaces the placeholders with the content and returns the rendered Subject

Return Value

string

string|null getBodyHtmlRendered()

Replaces the placeholders with the content and returns the rendered Html

Return Value

string|null

string getBodyTextRendered()

Replaces the placeholders with the content and returns the rendered text if a text was set with "$mail->setBodyText()"

Return Value

string

$this setDocument($document)

Parameters

$document

Return Value

$this

Exceptions

Exception

Email getDocument()

Returns the Document

Return Value

Email | null

Mail preventDebugInformationAppending()

Prevents appending of debug information (used for resending emails)

Return Value

Mail

bool isPreventingDebugInformationAppending()

Returns, if debug information is not added

Return Value

bool

bool getHtml2TextBinaryEnabled()

Return Value

bool

$this enableHtml2textBinary()

Return Value

$this

Exceptions

Exception

static bool getHtml2textInstalled()

Return Value

bool || null

protected string html2Text($htmlContent)

Parameters

$htmlContent

Return Value

string

string getBodyText()

Return Value

string

$this setBodyText($bodyText)

Parameters

$bodyText

Return Value

$this

Mail setBodyHtml($body)

Parameters

$body

Return Value

Mail

Swift_MimePart getBodyTextMimePart()

Return Value

Swift_MimePart

array getOriginalData()

Return Value

array

setOriginalData(array $originalData)

Parameters

array $originalData

$this addAttachment(Swift_Mime_Attachment $attachment)

Parameters

Swift_Mime_Attachment $attachment

Return Value

$this

Swift_Mime_Attachment createAttachment($data, $mimeType = null, $filename = null, $disposition = null)

Parameters

$data
$mimeType
$filename
$disposition

Return Value

Swift_Mime_Attachment

addTo($address, $name = null)

Parameters

$address
$name

Log getLastLogEntry()

Return Value

Log