当前位置: 首页>>代码示例>>PHP>>正文


PHP BxDolEmailTemplates::parseContent方法代码示例

本文整理汇总了PHP中BxDolEmailTemplates::parseContent方法的典型用法代码示例。如果您正苦于以下问题:PHP BxDolEmailTemplates::parseContent方法的具体用法?PHP BxDolEmailTemplates::parseContent怎么用?PHP BxDolEmailTemplates::parseContent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BxDolEmailTemplates的用法示例。


在下文中一共展示了BxDolEmailTemplates::parseContent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: sendMail

/**
 * Send email function
 *
 * @param string $sRecipientEmail		- Email where email should be send
 * @param string $sMailSubject			- subject of the message
 * @param string $sMailBody				- Body of the message
 * @param integer $iRecipientID			- ID of recipient profile
 * @param array $aPlus					- Array of additional information
 *
 *
 * @return boolean 						- trie if message was send
 * 										- false if not
 */
function sendMail($sRecipientEmail, $sMailSubject, $sMailBody, $iRecipientID = 0, $aPlus = array(), $sEmailFlag = 'html', $isDisableAlert = false, $bForceSend = false)
{
    global $site;
    if (!$sRecipientEmail || preg_match('/\\(2\\)$/', $sRecipientEmail)) {
        return false;
    }
    if ($iRecipientID) {
        $aRecipientInfo = getProfileInfo($iRecipientID);
    }
    // don't send mail to the user if he/she decided to not receive any site's notifications, unless it is critical emails (like email confirmation)
    if (!$bForceSend) {
        $aRealRecipient = $GLOBALS['MySQL']->getRow("SELECT * FROM `Profiles` WHERE `Email`='" . process_db_input($sRecipientEmail, BX_TAGS_NO_ACTION, BX_SLASHES_NO_ACTION) . "' LIMIT 1");
        if ($aRealRecipient && 1 != $aRealRecipient['EmailNotify']) {
            return true;
        }
    }
    $sEmailNotify = isset($GLOBALS['site']['email_notify']) ? $GLOBALS['site']['email_notify'] : getParam('site_email_notify');
    $sSiteTitle = isset($GLOBALS['site']['title']) ? $GLOBALS['site']['title'] : getParam('site_title');
    $sMailHeader = "From: =?UTF-8?B?" . base64_encode($sSiteTitle) . "?= <{$sEmailNotify}>";
    $sMailParameters = "-f{$sEmailNotify}";
    if ($aPlus || $iRecipientID) {
        if (!is_array($aPlus)) {
            $aPlus = array();
        }
        bx_import('BxDolEmailTemplates');
        $oEmailTemplates = new BxDolEmailTemplates();
        $sMailSubject = $oEmailTemplates->parseContent($sMailSubject, $aPlus, $iRecipientID);
        $sMailBody = $oEmailTemplates->parseContent($sMailBody, $aPlus, $iRecipientID);
    }
    $sMailSubject = '=?UTF-8?B?' . base64_encode($sMailSubject) . '?=';
    $sMailHeader = "MIME-Version: 1.0\r\n" . $sMailHeader;
    if (!$isDisableAlert && 'on' == getParam('bx_smtp_on')) {
        return BxDolService::call('smtpmailer', 'send', array($sRecipientEmail, $sMailSubject, $sMailBody, $sMailHeader, $sMailParameters, 'html' == $sEmailFlag, $aRecipientInfo));
    }
    if ('html' == $sEmailFlag) {
        $sMailHeader = "Content-type: text/html; charset=UTF-8\r\n" . $sMailHeader;
        $iSendingResult = mail($sRecipientEmail, $sMailSubject, $sMailBody, $sMailHeader, $sMailParameters);
    } else {
        $sMailHeader = "Content-type: text/plain; charset=UTF-8\r\n" . $sMailHeader;
        $sMailBody = html2txt($sMailBody);
        $iSendingResult = mail($sRecipientEmail, $sMailSubject, html2txt($sMailBody), $sMailHeader, $sMailParameters);
    }
    if (!$isDisableAlert) {
        //--- create system event
        bx_import('BxDolAlerts');
        $aAlertData = array('email' => $sRecipientEmail, 'subject' => $sMailSubject, 'body' => $sMailBody, 'header' => $sMailHeader, 'params' => $sMailParameters, 'html' => 'html' == $sEmailFlag ? true : false);
        $oZ = new BxDolAlerts('profile', 'send_mail', $aRecipientInfo['ID'], '', $aAlertData);
        $oZ->alert();
    }
    return $iSendingResult;
}
开发者ID:blas-dmx,项目名称:dolphin.pro,代码行数:64,代码来源:utils.inc.php

示例2: sendMail

/**
 * Send email function
 *
 * @param string $sRecipientEmail		- Email where email should be send
 * @param string $sMailSubject			- subject of the message
 * @param string $sMailBody				- Body of the message
 * @param integer $iRecipientID			- ID of recipient profile
 * @param array $aPlus					- Array of additional information
 *
 *
 * @return boolean 						- trie if message was send
 * 										- false if not
 */
function sendMail($sRecipientEmail, $sMailSubject, $sMailBody, $iRecipientID = 0, $aPlus = array(), $sEmailFlag = 'html', $isDisableAlert = false)
{
    global $site;
    if (!$sRecipientEmail) {
        return false;
    }
    if ($iRecipientID) {
        $aRecipientInfo = getProfileInfo($iRecipientID);
    }
    $sEmailNotify = isset($GLOBALS['site']['email_notify']) ? $GLOBALS['site']['email_notify'] : getParam('site_email_notify');
    $sSiteTitle = isset($GLOBALS['site']['title']) ? $GLOBALS['site']['title'] : getParam('site_title');
    $sMailHeader = "From: =?UTF-8?B?" . base64_encode($sSiteTitle) . "?= <{$sEmailNotify}>";
    $sMailParameters = "-f{$sEmailNotify}";
    if ($aPlus || $iRecipientID) {
        if (!is_array($aPlus)) {
            $aPlus = array();
        }
        $oEmailTemplates = new BxDolEmailTemplates();
        $sMailSubject = $oEmailTemplates->parseContent($sMailSubject, $aPlus, $iRecipientID);
        $sMailBody = $oEmailTemplates->parseContent($sMailBody, $aPlus, $iRecipientID);
    }
    $sMailSubject = '=?UTF-8?B?' . base64_encode($sMailSubject) . '?=';
    $sMailHeader = "MIME-Version: 1.0\r\n" . $sMailHeader;
    if ('html' == $sEmailFlag) {
        $sMailHeader = "Content-type: text/html; charset=UTF-8\r\n" . $sMailHeader;
        $iSendingResult = mail($sRecipientEmail, $sMailSubject, $sMailBody, $sMailHeader, $sMailParameters);
    } else {
        $sMailHeader = "Content-type: text/plain; charset=UTF-8\r\n" . $sMailHeader;
        $sMailBody = html2txt($sMailBody);
        $iSendingResult = mail($sRecipientEmail, $sMailSubject, html2txt($sMailBody), $sMailHeader, $sMailParameters);
    }
    if (!$isDisableAlert) {
        //--- create system event
        bx_import('BxDolAlerts');
        $aAlertData = array('email' => $sRecipientEmail, 'subject' => $sMailSubject, 'body' => $sMailBody, 'header' => $sMailHeader, 'params' => $sMailParameters, 'html' => 'html' == $sEmailFlag ? true : false);
        $oZ = new BxDolAlerts('profile', 'send_mail', $aRecipientInfo['ID'], '', $aAlertData);
        $oZ->alert();
    }
    return $iSendingResult;
}
开发者ID:dalinhuang,项目名称:shopexts,代码行数:53,代码来源:utils.inc.php


注:本文中的BxDolEmailTemplates::parseContent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。