Function ze\server::sendEmail()

In PHP:
ze\server::sendEmail(
$subject, $body, $addressTo, &$addressToOverriddenBy, $nameTo = false, $addressFrom = false, $nameFrom = false, $attachments = [], $attachmentFilenameMappings = [], $precedence = 'bulk', $isHTML = true, $exceptions = false, $addressReplyTo = false, $nameReplyTo = false, $warningEmailCode = false, $ccs = '', $bccs = '', $action = 'To', $ignoreDebugMode = false
)

Description

A shortcut function to sending an PHPMailer.

Parameters

$subject

The subject of the email

$body

The body of the email. Should be in HTML format; a plain-text version will be generated using PHP's html_entity_decode() and strip_tags() functions.

$addressTo

The email address to send to. May be overriden (please see the $addressToOverridenBy argument description below)

$addressToOverridenBy

Passed by reference. If a value of this argument is non empty string after function call, argument contains real, overridden destination address where the email was sent. The recipient email addresses can be overridden globally by using global site settings debug_override_enable and debug_override_email_address. These site settings can be changed under the Organizer Panel: Administration -> Settings -> Email.

$nameTo

A display name for the email address to send to. Defaults to the email address itself.

$addressFrom

The email address to send from. If this is not set, then $addressFrom and $nameFrom will default to the values defined in the site's configuration.

$nameFrom

A display name for the email address to send to. Defaults to the email address itself if an address is provided, otherwise uses the value defined in the site's configuration.

$attachements

An array of filenames with pathes, that resides in the filesystem and should be sent as email attachments.

$attachmentFilenameMappings

An array of strings that will be used as filenames visible to the email recipient. The first file from $attachments array will be attached to the email under the name defined by the first member of the $attachmentFilenameMappings array, the second file under the name defined by second member, and so on. If no corresponding entry exists in the $attachmentFilenameMappings file will be attached under it's real filename.

$precedence

This argument defines value of the message precedence header.

Return Value

Returns true if the email was sent successfully, otherwise returns false.

Example

$addressToOverriddenBy = '';
sendEmail(
'Test Email',
'<h1>Test Email</h1><p>This is a test</p>',
'yourname@zenar.io',
$addressToOverriddenBy
);

This line sends a test email. Can be useful for debugging.