AddEventHandler('main', 'OnBeforeUserUpdate', Array("regtur", "OnBeforeUserUpdateHandler"));
class regtur {
function OnBeforeUserUpdateHandler(&$arFields)
{
$SITE_ID = 'gu'; //Индетификатор сайта
$EVEN_TYPE = 'ADD_REG_TUR'; // Тип почтового события
$NAME = $arFields['NAME'];
global $USER;
$ADMIN = $USER->isAdmin();
$USERid = $USER->GetID();
$arParameters = array('FIELDS' => array('ID','NAME','LAST_NAME','SECOND_NAME','EMAIL', 'LOGIN'),);
$rsUsers = CUser::GetList(($by="ID"), ($order="desc"), array("ID"=>$USER_ID),array("SELECT"=>array("UF_*")),$arParameters);
$addUser = $rsUsers->Fetch();
$CHECK_RASSILKA = $addUser['UF_OK']; //Кнопка рассылки
$FIO = $addUser['LAST_NAME'] ." ". $addUser['NAME'] ." ". $addUser['SECOND_NAME'];
$MAIL = 'mills@arione.ru'; //Для проверки
$arFeedForm = array(
"URL" => $URL_ITEM,
"MAIL_TO" => $MAIL,
"FIO" => $FIO,
//"MM" => $EMAIL_TO,
"NAMEANNOUNS" => $NAME,
"EMAILCEO_SCHOOL" => $EMAILCEO_SCHOOL,
"EMAILCEO_SCHOOL_DOP" => $EMAILCEO_SCHOOL_DOP,
);
CEvent::Send($EVEN_TYPE, $SITE_ID, $arFeedForm);
}
}