Baseline: main 23.0+ · Verified: main 26.800.0
| Task | Read |
|---|---|
Event types, templates, #FIELD# macros, HTML escaping |
rules/templates.md |
Send (queue or immediate), attachments, Mail::sendResult(), sender identity, SMTP choice |
rules/sending.md |
| Hooks, queue processing and cron, testing, delivery diagnostics | rules/hooks-testing.md |
SMTP servers and the smtp section of .settings.php: bitrix-settings. Types and templates in migrations: bitrix-sprint-migration.
Invariants
- Send through a mail event with an admin-editable template (
Mail\Event::send()); build a raw message withMail::sendResult()only when no template fits. - The queue (
b_event) is the default; it is drained after hits or by cron. UsesendImmediate()only when the caller needs the outcome now. C_FIELDSvalues: strings or arrays of strings. The queue stores objects as(string)via__toString(), or''without it.- In HTML templates print user data as
#HTML_FIELD#;#FIELD#is inserted raw. - Validate every address that comes from user input (
check_email()) before it reaches a field used inEMAIL_TO,CCor headers. - A template must be bound to the site: create it with
CEventMessage, notEventMessageTable::add().