S
S
symply_rabbit2018-04-28 18:58:41
1C-Bitrix
symply_rabbit, 2018-04-28 18:58:41

Doesn't send email on OnAfterIBlockElementAdd event?

Good afternoon! emails are not sent when an event occurs after adding an element to the Bitrix infoblock OnAfterIBlockElementAdd.
There is a form,
form name="iblock_add" action="" method="post"
input type="text" name="name" placeholder="Your name"
input type="tel" name="phone" placeholder="Number phone"
input type="text" size="25" name="date" placeholder="Enter date"
input name="servise" type="text" value="<?=$arResult["NAME"]?> "
button name="submit" class="booking__btn btn btn-primary" type="submit">
Book /button When clicking on it, I used $element->Add($arLoadProductArray); , adds the new element without issue.
After this addition, you need to implement the sending of this information from the completed form to the mail.
for what - created the BOOKING mail event type
- created an event mail template, where he indicated:
Client name: "NAME"
Phone number: "PHONE"
Service name: "SERVISE"
Booking date: "DATE"
and then created an init with the content:
<?
//SENDING DATA FROM FORMS TO ADMIN AFTER ADDING TO INFOBLOC!!!
AddEventHandler("iblock", "OnAfterIBlockElementAdd", Array("MyClass3", "OnAfterIBlockElementAddHandler"));
class MyClass3
{
// create an event handler for the "OnAfterIBlockElementAdd" event
function OnAfterIBlockElementAddHandler(&$arFields)
{
if($arFields["
"NAME" => $arFields["NAME"],
"PHONE" => $_REQUEST["PROPERTY"]["9"]["0"],
"SERVISE" => $_REQUEST["PROPERTY"][" 24"]["0"],
"DATE" => $_REQUEST["PROPERTY"]["10"]["0"],
"SERVER_NAME" => "premium-relax.ru",
);
CEvent::Send("BOOKING", s1, $arEventFields, "N", 8);
}
}
}
?>
where 8 is the id of the mail event
. The letter is not sent. What could be the error?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
symply_rabbit, 2018-04-29
@symply_rabbit

already understand. Hosting problem

V
Vlad Zhivotnev, 2014-05-07
@tuxx

Why the increased memory consumption on VPS?
Does anyone use vpsget.com services?
etc.
In short, move to Xen or KVM.

O
Oleg Voitenko, 2014-07-31
@OliverV

or just disable keepalive for connections to start, so that they don’t multiply and hang for half a day

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question