25 'NAME' => Loc::getMessage(
'MAIL_NOTIFY_NEW_MESSAGE'),
35 'imposed_tariff_restrictions_on_the_mailbox' => [
36 'NAME' => Loc::getMessage(
'MAIL_NOTIFY_IMPOSE_TARIFF_RESTRICTIONS_ON_THE_MAILBOX'),
51 private static function getNotifyMessageForNewMessageSetInMail($mailboxId, $messageCount, $absoluteUrl =
false): string
58 $url =
$uri->toAbsolute()->getLocator();
61 return Loc::getMessage(
'MAIL_NOTIFY_NEW_MESSAGE_MULTI_1',
63 '#COUNT#' => $messageCount,
69 private static function getNotifyMessageForNewMessageInMail(
$message, $absoluteUrl =
false): string
76 $url =
$uri->toAbsolute()->getLocator();
81 return Loc::getMessage(
'MAIL_NOTIFY_NEW_SINGLE_MESSAGE_IN_MAIL_CLIENT_1',
90 return Loc::getMessage(
'MAIL_NOTIFY_NEW_SINGLE_MESSAGE_IN_MAIL_CLIENT_EMPTY_SUBJECT',
98 private static function getNotifyMessageForTariffRestrictionsMailbox($mailboxId,
$email, $forEmailNotification =
false): string
102 if ($forEmailNotification)
105 $url =
$uri->toAbsolute()->getLocator();
107 $text = Loc::getMessage(
'MAIL_NOTIFY_FULL_MAILBOX_TARIFF_RESTRICTIONS_HAVE_BEEN_IMPOSED',
110 '#VIEW_URL#' =>
$url,
116 $text = Loc::getMessage(
'MAIL_NOTIFY_MAILBOX_TARIFF_RESTRICTIONS_HAVE_BEEN_IMPOSED',
119 '#VIEW_URL#' =>
$url,
127 private static function notifyForNewMessagesInMail(
$userId,
$fields): void
134 'NOTIFY_MODULE' =>
'mail',
135 'NOTIFY_EVENT' => self::notifierSchemeTypeMail,
136 'NOTIFY_TITLE' => Loc::getMessage(
'MAIL_NOTIFY_NEW_MESSAGE_TITLE'),
137 'NOTIFY_MESSAGE_OUT' => empty(
$message)
138 ? self::getNotifyMessageForNewMessageSetInMail(
$fields[
'mailboxId'],
$fields[
'count'],
true)
139 : self::getNotifyMessageForNewMessageInMail(
$message,
true),
141 ? self::getNotifyMessageForNewMessageSetInMail(
$fields[
'mailboxId'],
$fields[
'count'])
142 : self::getNotifyMessageForNewMessageInMail(
$message),
147 private static function notifyForTariffRestrictions($mailboxId): void
149 $mailbox = MailboxTable::getList([
160 if (isset($mailbox[
'USER_ID']) && isset($mailbox[
'EMAIL']))
165 'NOTIFY_MODULE' =>
'mail',
166 'NOTIFY_EVENT' => self::notifierSchemeTypeMailTariffRestrictions,
167 'NOTIFY_TITLE' => Loc::getMessage(
'MAIL_NOTIFY_NEW_MESSAGE_TITLE'),
168 'NOTIFY_MESSAGE_OUT' => self::getNotifyMessageForTariffRestrictionsMailbox($mailboxId, $mailbox[
'EMAIL'],
true),
169 'NOTIFY_MESSAGE' => self::getNotifyMessageForTariffRestrictionsMailbox($mailboxId, $mailbox[
'EMAIL']),
170 'TO_USER_ID' => $mailbox[
'USER_ID'],
179 if (
$type ==
'new_message')
181 $mailboxId =
$fields[
'mailboxId'];
185 $mailboxOwnerId = (int)
$fields[
'mailboxOwnerId'] ?? 0;
189 $userIds = MailboxAccessTable::getUserIdsWithAccessToTheMailbox($mailboxId);
196 foreach ($userIds as $id)
198 self::notifyForNewMessagesInMail($id,
$fields);
201 else if (
$type ==
'imposed_tariff_restrictions_on_the_mailbox')
203 self::notifyForTariffRestrictions($mailboxId);
static includeModule($moduleName)
if(file_exists($_SERVER['DOCUMENT_ROOT'] . "/urlrewrite.php")) $uri