$arFields = Array(
"AUTHOR" => $_POST["user_name"],
"AUTHOR_EMAIL" => $_POST["user_email"],
"PHONE" => $_POST["user_phone"],
"EMAIL_TO" => $arParams["EMAIL_TO"],
"TEXT" => $_POST["MESSAGE"],
"FILE_NAME" => $_FILES['file']['name']
);
if($_POST["user_email"] !== $arParams["EMAIL_TO"]){
$file_array = [];
$arFields["EMAIL_TO"] = $_POST["user_email"];
}
CEvent::Send($arParams["EVENT_NAME"], SITE_ID, $arFields,"","",$file_array);
if($_POST["user_email"] !== $arParams["EMAIL_TO"]){
$file_array = [];
$arFields["EMAIL_TO"] = $_POST["user_email"];
}
CEvent::Send($arParams["EVENT_NAME"], SITE_ID, $arFields,"","",$file_array);