T
T
Tatiana2016-02-18 00:44:57
1C-Bitrix
Tatiana, 2016-02-18 00:44:57

How to bind a form and a mail template to each other?

Complementing the aspro.allcorp template, I
created a new form and a mail template, but I just can’t figure out how to link them together
(the form was made using an info block, no additional modules were installed)
I found this request:

$event_name_admin = $arResult["EVENT_TYPE"]."_ADMIN_".$arParams["IBLOCK_ID"];
  $arEvent = CEventType::GetByID( $event_name_admin, $arResult["SITE"]["LANGUAGE_ID"] )->Fetch();
  if( !is_array( $arEvent ) ){
    $et = new CEventType;
    $arEventFields = array(
      "LID" => $arResult["SITE"]["LANGUAGE_ID"],
      "EVENT_NAME" => $event_name_admin,
      "NAME" => GetMessage("FORM_ET_NAME")." \"".$arResult["IBLOCK_TITLE"]."\"",
      "DESCRIPTION" => $eventDescAdmin,
    );
    $et->Add($arEventFields);
    $arEventFields["LID"] = ($arResult["SITE"]["LANGUAGE_ID"] == 'ru' ? 'en' : 'ru');
    $et->Add($arEventFields);
  }

those. according to the template, the form should be sent ... but it takes a different ID (((
Tell me where, what can I see ???
Thanks in advance.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sergey, 2016-02-18
@gangstarcj

Your code Adds a mail event type , it doesn't send a mail
Here is an example of sending a mail message and here is another required API

$arFieldsSend = Array(
                        "NAME" => $arUser["NAME"],
                        "LAST_NAME" => $arUser["LAST_NAME"],
                        "MESSAGE" => "Сообщение для пользователя",
                        "EMAIL" => $arUser["EMAIL"],
                        "SALE_EMAIL" => COption::GetOptionString("sale", "order_email", "[email protected]" . $_SERVER['SERVER_NAME']),
                    );
                    $eventName = "USER_NEED_BUY";

                    $bSend = true;
                    if ($bSend) {
                        $event = new CEvent;
                        $event->Send($eventName, SITE_ID, $arFieldsSend, "N");
                    }

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question