16 private const PATH_MAIL_CONFIG =
'/mail/config/';
17 private const MAILBOX_LIMIT_SLIDER_CODE =
'limit_contact_center_mail_box_number';
19 private const RU_REGION_CODE =
'ru';
20 private const IMAP_TYPE =
'imap';
21 private const RU_PROVIDERS_LIST = [
'yandex',
'mailru',
'office365',
'gmail'];
22 private const WORLD_PROVIDER_LIST = [
'gmail',
'icloud',
'office365',
'yahoo'];
24 private bool $isSenderShowcase;
25 private ?
string $region;
29 $this->isSenderShowcase = $isSenderShowcase;
40 'isModuleMailInstalled' =>
false,
41 'promotionProviders' => $this->getPromotionProviders(),
42 'isSmtpAvailable' => $this->isSmtpAvailable(),
43 'isCloud' => $isCloud,
48 $intranetToolSettings = $this->getIntranetToolSettings();
49 extract($intranetToolSettings, EXTR_OVERWRITE);
51 $providers = $this->getProviders();
55 'isModuleMailInstalled' =>
true,
56 'canConnectNewMailbox' => $canConnectNewMailbox,
57 'mailboxLimitSliderCode' => self::MAILBOX_LIMIT_SLIDER_CODE,
58 'isMailToolAvailable' => $isMailToolAvailable ??
false,
59 'toolLimitSliderCode' => $toolLimitSliderCode ??
null,
60 'isSmtpAvailable' => $this->isSmtpAvailable(),
61 'isCloud' => $isCloud,
63 'providers' => $providers,
67 private function getIntranetToolSettings():
array
69 if (class_exists(
'\Bitrix\Mail\Integration\Intranet\ToolShowSettings'))
74 'isMailToolAvailable' => $toolShowSettings->isMailAvailable(),
75 'toolLimitSliderCode' => $toolShowSettings->getMailLimitSliderCode(),
80 'isMailToolAvailable' =>
true,
81 'toolLimitSliderCode' =>
null,
85 private function getProviders():
array
92 $services = Mailbox::getServices();
96 if (
$service[
'type'] !== self::IMAP_TYPE)
101 $uri =
new Uri(self::PATH_MAIL_CONFIG .
'new');
102 if ($this->isSenderShowcase)
104 $uri->addParams([
'smtp' =>
'Y']);
117 private function getPromotionProviders():
array
121 return self::WORLD_PROVIDER_LIST;
124 return (Localization\Loc::getDefaultLang($this->region) === self::RU_REGION_CODE) ? self::RU_PROVIDERS_LIST : self::WORLD_PROVIDER_LIST;
127 private function isSmtpAvailable(): bool
129 $defaultMailConfiguration = Configuration::getValue(
'smtp');
131 || $defaultMailConfiguration[
'enabled']
static includeModule($moduleName)
__construct(bool $isSenderShowcase)
if(file_exists($_SERVER['DOCUMENT_ROOT'] . "/urlrewrite.php")) $uri