mailer.email.sent¶
Direction: modules → server. Exact event pattern: mailer.email.sent.
Listener and purpose¶
Registered by event_handlers::EventsHandlerList::Create(Core*) in
handlers/EventsHandler.hpp, independently of action handlers.
The listener uses EventHandlerRecord, execution EventExecution::Inline,
max_payload_size = 16384 bytes (16 KiB).
sct-mailer publishes the event when the mail provider accepted an email, to the Moleculer groups handler and
server; the platform receives it as server. When the email was made by a manager
personally and the recipient is a customer, the platform records the contact:
last_contact_timebecomes the processing time, and never moves backwards: a repeated or late delivery of the same event does not roll it back;first_contact_timeis set to the same time only when it is empty.
The update is silent, like the last login time: the platform does not publish
customer.updated, does not run workflow rules on the customer.updated trigger and does
not send module events. See the customer fields in the Customers API.
Expected JSON structure¶
{
"emailId": 812,
"managerId": 10,
"sendToParentType": "CUSTOMER",
"sendToParentId": 140,
"source": "MANUAL",
"externalId": "prov-99213"
}
| Parameter | Type | Use |
|---|---|---|
| source | MANUAL, BULK, CAMPAIGN, TRIGGER or null |
Only MANUAL is counted |
| sendToParentType | CUSTOMER, LEAD, MANAGER or null |
Only CUSTOMER is counted |
| sendToParentId | Positive integer or null | Customer ID (customer_id) |
| managerId | Integer or null | Manager who initiated the email; not read |
| emailId | Integer | Email record in the mailer; not read |
| externalId | String or null | Provider message id; not read |
| Complete event payload | — | At most 16 KiB |
Processing rules¶
| Payload | Result |
|---|---|
source = MANUAL, recipient CUSTOMER with a positive id |
Contact recorded |
source is BULK, CAMPAIGN, TRIGGER, null or missing |
Skipped |
Recipient type LEAD, MANAGER, null or missing |
Skipped |
| Recipient id missing, null or not positive | Skipped |
| Customer not found | Skipped with a warning in the server log |
| Not an object, or a field of the wrong type | Rejected as invalid |
MANUAL means MailerSendEmail, a resend or a test send. Mass sends, campaigns and triggers are not a personal
contact and do not change the contact time.
Leads and clients are one customer table, and current CRM addresses both as CUSTOMER
with customer_id. LEAD is sent only by the legacy lead screen, and its id is the legacy
lead_id, not a customer_id — so LEAD is skipped rather than written to an unrelated
record.
Errors and delivery¶
Internal handler results: 400 on an invalid payload; 500 if the customer could not be updated; 200 for a recorded contact and for every skip. These results are not returned to the publisher. Router logs payload-limit, validation and handler failures internally.
There is no delivery ACK, persistence or offline queue: an event published while the platform is not connected is lost, and that contact is not recorded.
See the Mailer events, shared inbound rules and the inbound catalogue.