Answer the question
In order to leave comments, you need to log in
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
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 questionAsk a Question
731 491 924 answers to any question