Documentation

OnBeforeEventSend

The event OnBeforeEventSend is called before the message is sent.

Parameters

Parameter Description
arFieldslist of variables
arTemplate array of data for template
context mail context \Bitrix\Main\Mail\Context. The parameter is used to split e-mail flows, by defining category (flow) ID for the e-mails.

Example

AddEventHandler('main', 'OnBeforeEventSend', Array("MyForm", "my_OnBeforeEventSend"));
class MyForm
{
   public static function my_OnBeforeEventSend($arFields, $arTemplate)
   {
        
         //get the message
         $mess = $arTemplate["MESSAGE"];
         foreach($arFields as $keyField => $arField)
            $mess = str_replace('#'.$keyField.'#', $arField, $mess); //substitute the values into the template
   }
}

Parameters can be passed via links. Instead:

function my_OnBeforeEventSend($arFields, $arTemplate)

Use

function my_OnBeforeEventSend(&$arFields, &$arTemplate)


© «Bitrix24», 2001-2024
Up