本文整理汇总了PHP中CBPHelper::ConvertTextForMail方法的典型用法代码示例。如果您正苦于以下问题:PHP CBPHelper::ConvertTextForMail方法的具体用法?PHP CBPHelper::ConvertTextForMail怎么用?PHP CBPHelper::ConvertTextForMail使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CBPHelper
的用法示例。
在下文中一共展示了CBPHelper::ConvertTextForMail方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: Execute
public function Execute()
{
if (!CModule::IncludeModule("socialnetwork")) {
return CBPActivityExecutionStatus::Closed;
}
$rootActivity = $this->GetRootActivity();
$documentId = $rootActivity->GetDocumentId();
$arMessageUserFrom = CBPHelper::ExtractUsers($this->MessageUserFrom, $documentId, true);
$arMessageUserTo = CBPHelper::ExtractUsers($this->MessageUserTo, $documentId, false);
$arMessageFields = array("=DATE_CREATE" => $GLOBALS["DB"]->CurrentTimeFunction(), "MESSAGE_TYPE" => SONET_MESSAGE_SYSTEM, "FROM_USER_ID" => $arMessageUserFrom, "MESSAGE" => CBPHelper::ConvertTextForMail($this->MessageText));
$ar = array();
foreach ($arMessageUserTo as $userTo) {
if (in_array($userTo, $ar)) {
continue;
}
$ar[] = $userTo;
$arMessageFields["TO_USER_ID"] = $userTo;
CSocNetMessages::Add($arMessageFields);
}
return CBPActivityExecutionStatus::Closed;
}
示例2: Execute
public function Execute()
{
$rootActivity = $this->GetRootActivity();
$documentId = $rootActivity->GetDocumentId();
$documentService = $this->workflow->GetService("DocumentService");
$strMailUserFrom = "";
list($mailUserFromArray, $mailUserFromArrayString) = static::ExtractEmails($this->MailUserFromArray);
$arMailUserFromArray = CBPHelper::ExtractUsers($mailUserFromArray, $documentId, false);
foreach ($arMailUserFromArray as $user) {
$dbUser = CUser::GetList($b = "", $o = "", array("ID_EQUAL_EXACT" => $user));
if ($arUser = $dbUser->Fetch()) {
if (strlen($strMailUserFrom) > 0) {
$strMailUserFrom .= ", ";
}
if (!defined("BX_MS_SMTP") || BX_MS_SMTP !== true) {
if (strlen($arUser["NAME"]) > 0 || strlen($arUser["LAST_NAME"]) > 0) {
$strMailUserFrom .= "'" . preg_replace("#['\r\n]+#", "", CUser::FormatName(COption::GetOptionString("bizproc", "name_template", CSite::GetNameFormat(false), SITE_ID), $arUser)) . "' <";
}
}
$strMailUserFrom .= preg_replace("#[\r\n]+#", "", $arUser["EMAIL"]);
if (!defined("BX_MS_SMTP") || BX_MS_SMTP !== true) {
if (strlen($arUser["NAME"]) > 0 || strlen($arUser["LAST_NAME"]) > 0) {
$strMailUserFrom .= ">";
}
}
}
}
$mailUserFromTmp = $this->MailUserFrom;
if (strlen($mailUserFromTmp) > 0) {
if (strlen($strMailUserFrom) > 0) {
$strMailUserFrom .= ", ";
}
$strMailUserFrom .= preg_replace("#[\r\n]+#", "", $mailUserFromTmp);
}
if (!empty($mailUserFromArrayString)) {
foreach ($mailUserFromArrayString as $s) {
if (strlen($strMailUserFrom) > 0) {
$strMailUserFrom .= ", ";
}
$strMailUserFrom .= $s;
}
}
$strMailUserTo = "";
list($MailUserToArray, $MailUserToArrayString) = static::ExtractEmails($this->MailUserToArray);
$arMailUserToArray = CBPHelper::ExtractUsers($MailUserToArray, $documentId, false);
foreach ($arMailUserToArray as $user) {
$dbUser = CUser::GetList($b = "", $o = "", array("ID_EQUAL_EXACT" => $user));
if ($arUser = $dbUser->Fetch()) {
if (strlen($strMailUserTo) > 0) {
$strMailUserTo .= ", ";
}
$strMailUserTo .= preg_replace("#[\r\n]+#", "", $arUser["EMAIL"]);
}
}
$mailUserToTmp = $this->MailUserTo;
if (strlen($mailUserToTmp) > 0) {
if (strlen($strMailUserTo) > 0) {
$strMailUserTo .= ", ";
}
$strMailUserTo .= preg_replace("#[\r\n]+#", "", $mailUserToTmp);
}
if (!empty($MailUserToArrayString)) {
foreach ($MailUserToArrayString as $s) {
if (strlen($strMailUserTo) > 0) {
$strMailUserTo .= ", ";
}
$strMailUserTo .= $s;
}
}
$charset = $this->MailCharset;
if (!$this->IsPropertyExists("DirrectMail") || $this->DirrectMail == "Y") {
global $APPLICATION;
$strMailUserFrom = $APPLICATION->ConvertCharset($strMailUserFrom, SITE_CHARSET, $charset);
$strMailUserFrom = CBPMailActivity::EncodeHeaderFrom($strMailUserFrom, $charset);
$strMailUserTo = $APPLICATION->ConvertCharset($strMailUserTo, SITE_CHARSET, $charset);
$strMailUserTo = CBPMailActivity::EncodeMimeString($strMailUserTo, $charset);
$mailSubject = $APPLICATION->ConvertCharset($this->MailSubject, SITE_CHARSET, $charset);
$mailSubject = CBPMailActivity::EncodeSubject($mailSubject, $charset);
$mailText = $APPLICATION->ConvertCharset(CBPHelper::ConvertTextForMail($this->MailText), SITE_CHARSET, $charset);
$eol = CAllEvent::GetMailEOL();
mail($strMailUserTo, $mailSubject, $mailText, "From: " . $strMailUserFrom . $eol . "Reply-To: " . $strMailUserFrom . $eol . "X-Priority: 3 (Normal)" . $eol . "Content-Type: text/" . ($this->MailMessageType == "html" ? "html" : "plain") . "; charset=" . $charset . $eol . "X-Mailer: PHP/" . phpversion());
} else {
$siteId = null;
if ($this->IsPropertyExists("MailSite")) {
$siteId = $this->MailSite;
}
if (strlen($siteId) <= 0) {
$siteId = SITE_ID;
}
$arFields = array("SENDER" => $strMailUserFrom, "RECEIVER" => $strMailUserTo, "TITLE" => $this->MailSubject, "MESSAGE" => CBPHelper::ConvertTextForMail($this->MailText));
$event = new CEvent();
$event->Send("BIZPROC_MAIL_TEMPLATE", $siteId, $arFields, "N");
}
return CBPActivityExecutionStatus::Closed;
}
示例3: Execute
public function Execute()
{
if (!CModule::IncludeModule('crm')) {
CBPActivityExecutionStatus::Closed;
}
$rootActivity = $this->GetRootActivity();
$documentId = $rootActivity->GetDocumentId();
$documentService = $this->workflow->GetService("DocumentService");
$strMailUserFrom = "";
$arMailUserFromArray = CBPHelper::ExtractUsers($this->MailUserFromArray, $documentId, false);
foreach ($arMailUserFromArray as $user) {
$dbUser = CUser::GetList($b = "", $o = "", array("ID_EQUAL_EXACT" => $user));
if ($arUser = $dbUser->Fetch()) {
if (strlen($strMailUserFrom) > 0) {
$strMailUserFrom .= ", ";
}
if (!defined("BX_MS_SMTP") || BX_MS_SMTP !== true) {
if (strlen($arUser["NAME"]) > 0 || strlen($arUser["LAST_NAME"]) > 0) {
$strMailUserFrom .= "'" . preg_replace("#['\r\n]+#", "", CUser::FormatName(COption::GetOptionString("bizproc", "name_template", CSite::GetNameFormat(false), SITE_ID), $arUser)) . "' <";
}
}
$strMailUserFrom .= preg_replace("#[\r\n]+#", "", $arUser["EMAIL"]);
if (!defined("BX_MS_SMTP") || BX_MS_SMTP !== true) {
if (strlen($arUser["NAME"]) > 0 || strlen($arUser["LAST_NAME"]) > 0) {
$strMailUserFrom .= ">";
}
}
}
}
$mailUserFromTmp = $this->MailUserFrom;
if (strlen($mailUserFromTmp) > 0) {
if (strlen($strMailUserFrom) > 0) {
$strMailUserFrom .= ", ";
}
$strMailUserFrom .= preg_replace("#[\r\n]+#", "", $mailUserFromTmp);
}
$strMailTo = '';
if (is_array($this->MailCrmEntityToArray)) {
$addressType = $this->MailCrmEntityAddressType !== '' ? $this->MailCrmEntityAddressType : 'WORK';
foreach ($this->MailCrmEntityToArray as &$entityData) {
$s = '';
if (is_string($entityData)) {
$s = trim($entityData);
} elseif (is_array($entityData) && isset($entityData['VALUE'])) {
$s = trim($entityData['VALUE']);
}
if ($s === '') {
continue;
}
$entityInfo = array();
if (CCrmEntityHelper::ParseEntityKey($s, $entityInfo)) {
//Process entity key
$dbResult = CCrmFieldMulti::GetList(array('ID' => 'asc'), array('ENTITY_ID' => $entityInfo['ENTITY_TYPE_NAME'], 'ELEMENT_ID' => $entityInfo['ENTITY_ID'], 'TYPE_ID' => 'EMAIL', 'VALUE_TYPE' => $addressType));
if ($dbResult) {
while ($arField = $dbResult->Fetch()) {
$v = isset($arField['VALUE']) ? trim($arField['VALUE']) : '';
if ($v === '' || !check_email($v)) {
continue;
}
if ($strMailTo !== '') {
$strMailTo .= ', ';
}
$strMailTo .= preg_replace("#[\r\n]+#", "", $v);
break;
}
}
} else {
$ary = explode(',', $s);
foreach ($ary as &$v) {
$v = trim($v);
if ($v === '' || !check_email($v)) {
continue;
}
if ($strMailTo !== '') {
$strMailTo .= ', ';
}
$strMailTo .= preg_replace("#[\r\n]+#", "", $v);
}
unset($v);
}
}
unset($entityData);
}
$strReplyTo = $strMailUserFrom;
$strCrmEmail = CCrmMailHelper::ExtractEmail(COption::GetOptionString('crm', 'mail', ''));
if ($strCrmEmail !== '') {
$strReplyTo .= ', ' . $strCrmEmail;
}
$charset = $this->MailCharset;
if (!$this->IsPropertyExists("DirrectMail") || $this->DirrectMail == "Y") {
global $APPLICATION;
$strMailUserFrom = $APPLICATION->ConvertCharset($strMailUserFrom, SITE_CHARSET, $charset);
$strMailUserFrom = self::EncodeHeaderFrom($strMailUserFrom, $charset);
$strReplyTo = $APPLICATION->ConvertCharset($strReplyTo, SITE_CHARSET, $charset);
$strReplyTo = self::EncodeHeaderFrom($strReplyTo, $charset);
$strMailTo = $APPLICATION->ConvertCharset($strMailTo, SITE_CHARSET, $charset);
$strMailTo = self::EncodeMimeString($strMailTo, $charset);
$mailSubject = $APPLICATION->ConvertCharset($this->MailSubject, SITE_CHARSET, $charset);
$mailSubject = self::EncodeSubject($mailSubject, $charset);
$mailText = $APPLICATION->ConvertCharset(CBPHelper::ConvertTextForMail($this->MailText), SITE_CHARSET, $charset);
//.........这里部分代码省略.........