Answer the question
In order to leave comments, you need to log in
How to find out which email a form uses in Bitrix?
skrinshoter.ru/s/310516/ANIyXu?a
There is a type of infoblocks - forms, there are about 10 of them with different layouts scattered on the site, How do I know which mail letters should be sent to? I saw mail is indicated in the settings of the main module, and in principle, now all letters fall there. I want to make a separate email for each form, where can I set it up? And yet, if someone came across a detailed tutorial on how to program your form on Bitrix, share the link )
ps Another question is how to add #DEFAULT_EMAIL_FROM_1#
#DEFAULT_EMAIL_FROM_2# , i.e. your own fields. anyway
Answer the question
In order to leave comments, you need to log in
In the OnAfterIBlockElementAdd handler, override whatever you want and send via CEvent::SendImmediate
Example:
AddEventHandler("iblock", "OnAfterIBlockElementAdd", Array("CIBlockHandlers", "OnAfterIBlockElementAddHandler"));
class CIBlockHandlers{
function OnAfterIBlockElementAddHandler(&$arFields){
if( $arFields["ID"] > 0 ){
$arFilter = Array("ID" => $arFields["ID"] );
$arSelect = Array("ID", "IBLOCK_CODE","NAME", "PROPERTY_TEXT", "PROPERTY_PHONE", "PROPERTY_EMAIL");
$res = CIBlockElement::GetList(array("SORT"=>"ASC"), $arFilter, false, false, $arSelect);
while( $ob = $res->GetNextElement() ){
$arFields2 = $ob->GetFields();
if($arFields2["IBLOCK_CODE"]=="complaints"){
$arFieldsEmail = array(
"PHONE" => $arFields2["PROPERTY_PHONE_VALUE"],
"EMAIL_FROM_1" => $arFields2["PROPERTY_EMAIL_VALUE"],
"TEXT" => $arFields2["PROPERTY_TEXT_VALUE"],
);
CEvent::SendImmediate("MAIL_DIRECTOR","s1",$arFieldsEmail);
}
}
}
else
AddMessage2Log("Ошибка добавления записи (".$arFields["RESULT_MESSAGE"].").");
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question