8namespace Bitrix\Sender\Message;
11use Bitrix\Main\Localization\Loc;
12use Bitrix\Main\Result;
13use Bitrix\Main\Config\Option;
14use Bitrix\Main\SystemException;
15use Bitrix\Main\UserTable;
17use Bitrix\Sender\Entity;
18use Bitrix\Sender\Posting;
19use Bitrix\Sender\Recipient;
20use Bitrix\Sender\Message;
21use Bitrix\Sender\Security;
22use Bitrix\Sender\Integration;
23use Bitrix\Sender\Transport\CountLimiter;
24use Bitrix\Sender\Transport\TimeLimiter;
26Loc::loadMessages(__FILE__);
57 $isSupport = in_array(
58 $this->message->getCode(),
86 $types = $this->message->getSupportedRecipientTypes();
88 $type = current($types);
119 $u = UserTable::getRowById(
$GLOBALS[
'USER']->getID());
120 $code = $u[
'PERSONAL_MOBILE'] ?: $u[
'WORK_PHONE'] ?: $u[
'PERSONAL_PHONE'] ?:
null;
144 $email = Option::get(
'sender',
'address_send_to_me');
147 $addressToList = explode(
',',
$email);
148 $addressToList = array_unique($addressToList);
152 return $addressToList;
163 $codes = is_array($codes) ? $codes :
array();
168 $codes = $this->
cutCodes($codes,
true);
188 \CUserOptions::setOption(
223 $length = (int) Option::get(
'sender',
'max_last_codes', 0);
224 $length = $length > 0 ? $length : self::MAX_LAST_CODES;
229 return array_slice($codes, 0, $length);
242 foreach ($codes as
$code)
280 if(!
Security\User::current()->isAgreementAccepted())
287 $name = isset($parameters[
'NAME']) ? $parameters[
'NAME'] :
null;
289 $userId = isset($parameters[
'USER_ID']) ? $parameters[
'USER_ID'] :
null;
291 $fields = isset($parameters[
'FIELDS']) ? $parameters[
'FIELDS'] :
array();
293 $this->message->getTransport()->start();
296 foreach ($codes as
$code)
298 if (self::MAX_SEND_CODES &&
$count++ >= self::MAX_SEND_CODES)
300 $result->addError(
new Error(Loc::getMessage(
'SENDER_MESSAGE_TESTER_ERROR_MAX_COUNT', [
'%count%' => self::MAX_SEND_CODES])));
304 if ($this->message->getTransport()->isLimitsExceeded($this->message))
306 $limiter = $this->message->getTransport()->getExceededLimiter();
309 if (($limiter instanceof
CountLimiter) && $limiter->getName() ===
'portal_verify')
311 $result->addError(
new Error(Loc::getMessage(
'SENDER_MESSAGE_TESTER_ERROR_LIMIT_PORTAL_VERIFY_FAILED',
array(
'%name%' =>
$code))));
317 $result->addError(
new Error(Loc::getMessage(
'SENDER_MESSAGE_TESTER_ERROR_LIMIT_EXCEEDED',
array(
'%name%' =>
$code))));
324 if ($this->message->getCode() ===
Message\IBase::CODE_MAIL) {
326 if ($verifyLimit->getCurrent() >= $verifyLimit->getLimit())
328 $result->addError(
new Error(Loc::getMessage(
'SENDER_MESSAGE_TESTER_ERROR_LIMIT_PORTAL_VERIFY_FAILED',
array(
'%name%' =>
$code))));
334 if ($testerDailyLimit->getCurrent() >= $testerDailyLimit->getLimit())
336 $result->addError(
new Error(Loc::getMessage(
'SENDER_MESSAGE_TESTER_ERROR_LIMIT_EXCEEDED',
array(
'%name%' =>
$code))));
348 $result->addError(
new Error(Loc::getMessage(
'SENDER_MESSAGE_TESTER_ERROR_WRONG_RECIPIENT',
array(
'%name%' =>
$code))));
354 'CAMPAIGN_ID' => $campaignId,
355 'CONTACT_CODE' =>
$code,
356 'CONTACT_TYPE' =>
$type,
365 $sendResult = $this->message->send();
366 if (!$sendResult &&
$result->isSuccess())
368 $to = $this->message->getRecipientCode();
369 $result->addError(
new Error(Loc::getMessage(
'SENDER_MESSAGE_TESTER_ERROR_SENT',
array(
'%name%' => $to))));
388 $this->message->getTransport()->end();
if(!is_object($USER)||! $USER->IsAuthorized()) $userId
static getDefaultId($siteId=null)
__construct(Adapter $message)
send(array $codes, array $parameters)
prepareCodes(array $codes, $doCut=true)
cutCodes(array $codes, $isRemoveLast=false)
setLastCodes(array $list)
static $userOptionLastCodesName
getUserOptionLastCodesName()
static applyRecipientToMessage(Adapter $message, array $recipient, $isTest=false)
static normalize($code, $typeId=Type::EMAIL)
static detect($recipientCode, $isNormalized=false)
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
if(!is_null($config))($config as $configItem)(! $configItem->isVisible()) $code
TrimArr(&$arr, $trim_value=false)
$GLOBALS['____1690880296']