23 $mailServices = array(
25 'SERVER' =>
'imap.gmail.com',
28 'LINK' =>
'https://mail.google.com/',
29 'SMTP_SERVER' =>
'smtp.gmail.com',
31 'SMTP_ENCRYPTION' =>
'Y',
32 'SMTP_LOGIN_AS_IMAP' =>
'Y',
33 'SMTP_PASSWORD_AS_IMAP' =>
'Y',
34 'UPLOAD_OUTGOING' =>
'N',
37 'SERVER' =>
'imap.mail.me.com',
40 'LINK' =>
'https://www.icloud.com/#mail',
41 'SMTP_SERVER' =>
'smtp.mail.me.com',
43 'SMTP_ENCRYPTION' =>
'N',
44 'SMTP_LOGIN_AS_IMAP' =>
'Y',
45 'SMTP_PASSWORD_AS_IMAP' =>
'Y',
46 'UPLOAD_OUTGOING' =>
'Y',
48 'outlook.com' => array(
49 'SERVER' =>
'imap-mail.outlook.com',
52 'LINK' =>
'https://www.outlook.com/owa',
53 'SMTP_SERVER' =>
'smtp-mail.outlook.com',
55 'SMTP_ENCRYPTION' =>
'N',
56 'SMTP_LOGIN_AS_IMAP' =>
'Y',
57 'SMTP_PASSWORD_AS_IMAP' =>
'Y',
58 'UPLOAD_OUTGOING' =>
'Y',
61 'SERVER' =>
'outlook.office365.com',
64 'LINK' =>
'http://mail.office365.com/',
65 'SMTP_SERVER' =>
'smtp.office365.com',
67 'SMTP_ENCRYPTION' =>
'N',
68 'SMTP_LOGIN_AS_IMAP' =>
'Y',
69 'SMTP_PASSWORD_AS_IMAP' =>
'Y',
70 'UPLOAD_OUTGOING' =>
'N',
73 'SERVER' =>
'imap.mail.yahoo.com',
76 'LINK' =>
'http://mail.yahoo.com/',
77 'SMTP_SERVER' =>
'smtp.mail.yahoo.com',
79 'SMTP_ENCRYPTION' =>
'Y',
80 'SMTP_LOGIN_AS_IMAP' =>
'Y',
81 'SMTP_PASSWORD_AS_IMAP' =>
'Y',
82 'UPLOAD_OUTGOING' =>
'N',
85 'SERVER' =>
'imap.aol.com',
88 'LINK' =>
'http://mail.aol.com/',
89 'SMTP_SERVER' =>
'smtp.aol.com',
91 'SMTP_ENCRYPTION' =>
'Y',
92 'SMTP_LOGIN_AS_IMAP' =>
'Y',
93 'SMTP_PASSWORD_AS_IMAP' =>
'Y',
94 'UPLOAD_OUTGOING' =>
'Y',
97 'SERVER' =>
'imap.yandex.ru',
100 'LINK' =>
'https://mail.yandex.ru/',
101 'SMTP_SERVER' =>
'smtp.yandex.ru',
103 'SMTP_ENCRYPTION' =>
'Y',
104 'SMTP_LOGIN_AS_IMAP' =>
'Y',
105 'SMTP_PASSWORD_AS_IMAP' =>
'Y',
106 'UPLOAD_OUTGOING' =>
'Y',
109 'SERVER' =>
'imap.mail.ru',
112 'LINK' =>
'http://e.mail.ru/',
113 'SMTP_SERVER' =>
'smtp.mail.ru',
115 'SMTP_ENCRYPTION' =>
'Y',
116 'SMTP_LOGIN_AS_IMAP' =>
'Y',
117 'SMTP_PASSWORD_AS_IMAP' =>
'Y',
118 'UPLOAD_OUTGOING' =>
'Y',
120 'exchange' => array(),
122 'exchangeOnline' => array(
123 'SERVER' =>
'outlook.office365.com',
126 'LINK' =>
'https://mail.office365.com/',
127 'SMTP_SERVER' =>
'smtp.office365.com',
129 'SMTP_ENCRYPTION' =>
'N',
130 'SMTP_LOGIN_AS_IMAP' =>
'Y',
131 'SMTP_PASSWORD_AS_IMAP' =>
'Y',
132 'UPLOAD_OUTGOING' =>
'N',
136 $mailServicesByLang = array(
139 200 =>
'outlook.com',
142 550 =>
'exchangeOnline',
151 200 =>
'outlook.com',
154 550 =>
'exchangeOnline',
161 200 =>
'outlook.com',
164 550 =>
'exchangeOnline',
171 200 =>
'outlook.com',
174 550 =>
'exchangeOnline',
181 $site = \Bitrix\Main\SiteTable::getList(array(
'filter' => [
"=LID" => $siteId]))
187 if (\CModule::IncludeModule(
'extranet') && \CExtranet::IsExtranetSite($site[
'LID']))
190 $portalZone = \Bitrix\Main\Loader::includeModule(
'bitrix24')
191 ? \CBitrix24::getPortalZone()
192 : $site[
'LANGUAGE_ID']
195 $portalZone = $portalZone ?: LANGUAGE_ID;
196 $portalZone = !in_array($portalZone, [
'ru',
'kz',
'by']) ? $portalZone :
'ru';
198 $mailServicesList = isset($mailServicesByLang[$portalZone])
199 ? $mailServicesByLang[$portalZone]
200 : $mailServicesByLang[
'en'];
202 foreach ($mailServicesList as $serviceSort => $serviceName)
204 $exists = \Bitrix\Mail\MailServicesTable::getRow([
206 '=SITE_ID' => $site[
'LID'],
207 '=NAME' => $serviceName,
208 '=SERVICE_TYPE' =>
'imap',
217 $serviceSettings = $mailServices[$serviceName];
219 $serviceSettings[
'SITE_ID'] = $site[
'LID'];
220 $serviceSettings[
'ACTIVE'] =
'Y';
221 $serviceSettings[
'SERVICE_TYPE'] =
'imap';
222 $serviceSettings[
'NAME'] = $serviceName;
223 $serviceSettings[
'SORT'] = $serviceSort;
225 \Bitrix\Mail\MailServicesTable::add($serviceSettings);
240 $version = (int)Option::get(self::MODULE_NAME, self::OPTION_NAME, 0, $siteId);
242 if ($version === self::SERVICES_VERSION)
246 Option::set(self::MODULE_NAME, self::OPTION_NAME, self::SERVICES_VERSION, $siteId);