AdminPageFramework_FormEmail::send PHP Метод

send() публичный Метод

public send ( )
    public function send()
    {
        $aEmailOptions = $this->aEmailOptions;
        $aInput = $this->aInput;
        $sSubmitSectionID = $this->sSubmitSectionID;
        if ($_bIsHTML = $this->_getEmailArgument($aInput, $aEmailOptions, 'is_html', $sSubmitSectionID)) {
            add_filter('wp_mail_content_type', array($this, '_replyToSetMailContentTypeToHTML'));
        }
        if ($this->_sEmailSenderAddress = $this->_getEmailArgument($aInput, $aEmailOptions, 'from', $sSubmitSectionID)) {
            add_filter('wp_mail_from', array($this, '_replyToSetEmailSenderAddress'));
        }
        if ($this->_sEmailSenderName = $this->_getEmailArgument($aInput, $aEmailOptions, 'name', $sSubmitSectionID)) {
            add_filter('wp_mail_from_name', array($this, '_replyToSetEmailSenderAddress'));
        }
        $_bSent = wp_mail($this->_getEmailArgument($aInput, $aEmailOptions, 'to', $sSubmitSectionID), $this->_getEmailArgument($aInput, $aEmailOptions, 'subject', $sSubmitSectionID), $_bIsHTML ? $this->getReadableListOfArrayAsHTML((array) $this->_getEmailArgument($aInput, $aEmailOptions, 'message', $sSubmitSectionID)) : $this->getReadableListOfArray((array) $this->_getEmailArgument($aInput, $aEmailOptions, 'message', $sSubmitSectionID)), $this->_getEmailArgument($aInput, $aEmailOptions, 'headers', $sSubmitSectionID), $this->_formatAttachements($this->_getEmailArgument($aInput, $aEmailOptions, 'attachments', $sSubmitSectionID)));
        remove_filter('wp_mail_content_type', array($this, '_replyToSetMailContentTypeToHTML'));
        remove_filter('wp_mail_from', array($this, '_replyToSetEmailSenderAddress'));
        remove_filter('wp_mail_from_name', array($this, '_replyToSetEmailSenderAddress'));
        foreach ($this->_aPathsToDelete as $_sPath) {
            unlink($_sPath);
        }
        return $_bSent;
    }

Usage Example

 public function _replyToSendFormEmail()
 {
     if (self::$_bDoneEmail) {
         return;
     }
     self::$_bDoneEmail = true;
     $_sTransient = $this->oUtil->getElement($_GET, 'transient', '');
     if (!$_sTransient) {
         return;
     }
     $_aFormEmail = $this->oUtil->getTransient($_sTransient);
     $this->oUtil->deleteTransient($_sTransient);
     if (!is_array($_aFormEmail)) {
         return;
     }
     $_oEmail = new AdminPageFramework_FormEmail($_aFormEmail['email_options'], $_aFormEmail['input'], $_aFormEmail['section_id']);
     $_bSent = $_oEmail->send();
     exit;
 }