Last Modified: 17.10.2022
Types of email events are described at the page Settings > Service Settings > Email and SMS events > Event types :
To edit email event types, select the Edit item in the actions menu. To add new type, click on the Add a type button at the context menu to open the form:
Enter name for a created type. Checkmark description languages for your new type and fill out the fields Sort, Name and Description. Enter available fields in the Description field (macroses of
#SOMETHING# type), to be used in email template message body, belonging to the type created by you.
It's recommended to use a suitable module abbreviation (in our particular case - WF for workflows in bizproc module) as the first part of the name for the email event. This simplifies the navigation in the email event list.
Working using the API
The text below requires some level of coding skill. If you are not sure that you are knowledgeable enough in coding, please consult a skilled developer.
Type of an email event is created either in the Control Panel (as description above) or via API using the method CEventType::Add. The event is called by the method CEvent::Send. Examples of handling these methods can be found in the available documentation. You can also find how to handle specific events in the Bitrix Framework learning course.
Macroses for templates of email event messages are taken from type description plus system macroses.
System macroses are values, specified in the Main module settings. There are 4 system macroses in total:
#DEFAULT_EMAIL_FROM# - Website administrator e-mail (default "From" address):,
#DEFAULT_SENDER# - Default sender number field
#SITE_NAME# - Site name field
#SERVER_NAME# - Site URL field.
When calling an event, you don't have to pass values for system macroses, they are inserted by default. But, a custom value passed by a developer will replace the system value.
Macroses from description are sourced from an array declared by the method CEventType::Add.
The macroses themselves are replaced by array values using macros name keys. For example, an event added with array containing the following fields:
'ORDER_ID' => 123,
'ORDER_PAID' => 'Y',
'BUYER_NAME' => 'John'
Email template can use the fields, via these macroses:
Starting from main module version 15.0.7 (with enabled PHP use in email template) the same can be specified as follows:
Resulting email template body has array of passed fields is accessible via the variable
Please note that after being created the event type won't be triggered immediately. The developer must call this event type in the required API locations. The administrator who created a new event type must pass
the event type name
In our case:
, list of values that must be available in the templates of this event as macroses, as well as conditions, when this event must be
In our case - when changing the workflow status to our custom status.