本文整理汇总了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;
}
示例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;
}