How to check if Beatrix in a letter to the administrator to add an attachment if the user does not?

It didn't work out
component Mein fitback
$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"]){
CEvent::Send($arParams["EVENT_NAME"], SITE_ID, $arFields,"","",$file_array);}
else{
CEvent::Send($arParams["EVENT_NAME"], SITE_ID, $arFields,"","");
}
April 4th 20 at 13:01
1 answer
April 4th 20 at 13:03
Came out what? to compare two email addresses, or add Blonie?
Yes , $arParams["EMAIL_TO"] this is not the address of departure ,it is always equal to Agris administrator, if not mistaken ,don't know how to get the address of departure - braxton.Howe commented on April 4th 20 at 13:06
@braxton.Howe, $arParams["EMAIL_TO"] = this is the address that is specified in the component parameters. $_POST["user_email"] - here is the address from the form.

Rewrite the condition as:
if the address is not admin(in component parameters), then reset the array of files and set the option to send from the form.
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);
- jailyn_Schultz7 commented on April 4th 20 at 13:09
@jailyn_Schultz7, $_POST["user_email"] !== $arParams["EMAIL_TO"] so this condition is fulfilled in both cases to go, if I'm in the form of a recorded address my@mail.ru it will compare with info@sait.ru and in both cases it is true,I need to compare with the address of departure info@sait.ru with the address of departure and not $_POST["user_email"] -- which the user entered in the form field email , but do not know how to get it - braxton.Howe commented on April 4th 20 at 13:12
@braxton.Howe, and I about the same)

this code is my try

$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);
- jailyn_Schultz7 commented on April 4th 20 at 13:15
I have the same code in a component I explain that this condition not be suitable ,then compare that implied if($_POST["user_email"] !== $arParams["EMAIL_TO"]){

the first event of the year letter to admin
admin info@sait.ru === $_POST["user_email"] and my@mail.ru ===$_POST["user_email"] comes to a condition of the second case is when the email client
admin info@sait.ru === $_POST["user_email"] and my@mail.ru ===$_POST["user_email"] ,they are always different info@sait.ru === $_POST["user_email"] constant ,and it is my@mail.ru ===$_POST["user_email"] email of Polovets they can't be equal,here is how to compare,another thing is, if compared with the address of departure again,which are unable to - braxton.Howe commented on April 4th 20 at 13:18
@braxton.Howe, in Russian, in simple words. Nothing is clear. - jailyn_Schultz7 commented on April 4th 20 at 13:21
@jailyn_Schultz7, this condition is not suitable should be $_POST["user_email"] with AMISOM departure ,but not konstantas
in this condition always enters if($_POST["user_email"] !== $arParams["EMAIL_TO"]){
how do you get $arParams["EMAIL_TO"]){ ? - braxton.Howe commented on April 4th 20 at 13:24
@braxton.Howe, var_dump( $arParams["EMAIL_TO"]); - jailyn_Schultz7 commented on April 4th 20 at 13:27

Find more questions by tags 1C-Bitrix