• Модуль: mail
  • Путь к файлу: ~/bitrix/modules/mail/classes/general/rest.php
  • Класс: CMailRestService
  • Вызов: CMailRestService::mailserviceDelete
static function mailserviceDelete($arParams)
{
	global $USER;

	IncludeModuleLangFile(__FILE__);

	if (!$USER->CanDoOperation('bitrix24_config'))
		throw new Exception(GetMessage('ACCESS_DENIED'));

	if (empty($arParams['ID']))
		throw new Exception(GetMessage('MAIL_MAILSERVICE_EMPTY_ID'));

	$result = BitrixMailMailServicesTable::getList(array(
		'filter' => array('=ID' => $arParams['ID'], '=SITE_ID' => SITE_ID)
	));

	if (!$result->fetch())
		throw new Exception(GetMessage('MAIL_MAILSERVICE_EMPTY'));

	$result = BitrixMailMailServicesTable::delete($arParams['ID']);

	if (!$result->isSuccess())
		throw new Exception(join('; ', $result->getErrorMessages()));

	return true;
}