ExpressionEngine® 3 User Guide

Legacy Documentation

You are using the documentation for version 3.5.17. Go here for the latest version or check here for your available upgrades to the latest version.

Email Library Extension Hooks

email_send

email_send(&$data)

Modify email headers, recipients and body data, and optionally take over email sending completely.

How it’s called:

$ret = ee()->extensions->call(
    'email_send',
    array(
        'headers'       => &$this->_headers,     // Email headers array
        'header_str'    => &$this->_header_str,  // Header string
        'recipients'    => &$this->_recipients,  // Recipients string
        'cc_array'      => &$this->_cc_array,    // CC recipients, populated by Email::cc(), used by SMTP
        'bcc_array'     => &$this->_bcc_array,   // BCC recipients, populated by Email::bcc(), used by SMTP
        'subject'       => &$this->_subject,     // Email subject
        'finalbody'     => &$this->_finalbody    // Final email body text
    )
);

if (ee()->extensions->end_script === TRUE)
{
    return $ret;
}

Note

If the extension decides to take over sending of the email, end_script should be set to TRUE, and _spool_email will return the extension’s return value, preferably a boolean indicating success or failure

Parameters:
  • &$data (array) – Array of data about email to be sent (see above) passed by reference so data may be altered without needing to return the altered data
Returns:

TRUE if successfully sent, FALSE if not

Return type:

Boolean

New in version 2.5.0.