E
E
Egor Tregubenko2016-05-31 12:13:30
PHP
Egor Tregubenko, 2016-05-31 12:13:30

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

2 answer(s)
S
Sergey, 2016-05-31
@Sinecuraweb

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"].").");
  }
}

S
Sergey, 2016-05-31
@gangstarcj

There is a special thing for forms joxi.ru/Y2LkLyahnz8W3m
It's too custom for you, so do what you want (most likely you can specify it in email templates), or contact a specialist

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question