M
M
mills2020-02-29 18:38:18
1C-Bitrix
mills, 2020-02-29 18:38:18

An email is not sent from the OnBeforeUserUpdate event, what's the problem?

Hello.
Wrote an event to send a letter when the user's data changes.
Everything seems to be correct, but even it does not send, what is the error? Who will tell?

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 = '[email protected]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);
    }
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Michael Lyamin, 2020-03-02
@BusteR27

Invalid user id specified in the filter Must be
array("ID"=>$USER_ID)
array("ID"=>$arFields['ID'])

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question