require_once $_SERVER["DOCUMENT_ROOT"] . BX_ROOT . "/modules/mail/prolog.php";
ClearVars();
$message = null;
$MOD_RIGHT = $APPLICATION->GetGroupRight("mail");
if ($MOD_RIGHT < "R") {
    $APPLICATION->AuthForm(GetMessage("ACCESS_DENIED"));
}
IncludeModuleLangFile(__FILE__);
Bitrix\Main\Loader::includeModule('mail');
$err_mess = "File: " . __FILE__ . "<br>Line: ";
$strError = "";
$ID = intval($ID);
$bCanUseTLS = defined('BX_MAIL_FORCE_USE_TLS') && BX_MAIL_FORCE_USE_TLS === true || function_exists('openssl_open');
$str_ACTIVE = 'Y';
$str_SORT = 100;
$ms = Bitrix\Mail\MailServicesTable::getById($ID)->fetch();
if ($ms) {
    $str_ID = $ms['ID'];
    $str_SITE_ID = $ms['SITE_ID'];
    $str_ACTIVE = $ms['ACTIVE'];
    $str_TYPE = $ms['SERVICE_TYPE'];
    $str_NAME = $ms['NAME'];
    $str_SERVER = $ms['SERVER'];
    $str_PORT = $ms['PORT'];
    $str_ENCRYPTION = $ms['ENCRYPTION'];
    $str_LINK = $ms['LINK'];
    $str_ICON = $ms['ICON'];
    $str_TOKEN = $ms['TOKEN'];
    $str_SORT = $ms['SORT'];
} else {
    $ID = 0;