Email & Mail Worker
Receive inbound mail through the Cloudflare worker and send outbound mail through the platform pipeline. This guide follows version 3.1.7 (03acdf712c).
For broadcasts, see Broadcasts & Notifications.
Inbound path
cloudflare/mail-worker/src/(index.ts,parse.ts,storage.ts,address.ts,routes.ts,hmac.ts) parses the message, derives the tenant from the address, queuesMAIL_QUEUE, and delivers with HMAC headers (x-erxes-signature,x-erxes-timestamp) plus a DLQ (erxes-mail-dlq).backend/plugins/frontline_api/src/modules/integrations/mail/receives atPOST /mail/receive(routes.ts, mounted insrc/routes.ts).controller/receiveMessage.tsverifies the signature headers, parses tagged addresses, threads viafindConversationByReplyTag/findRelatedConversation, stores the message, and emitsreceiveInboxMessagepluspConversationClientMessageInserted.messageBroker.tsmanages integration lifecycle (mailCreateIntegration,mailUpdateIntegration, address building, indexes, sendability checks).
Outbound path
- Core helpers:
backend/core-api/src/utils/email/(links.tsfor gateway, read-file, unsubscribe, tracker URLs;senders.ts,ramp.ts,intake.ts,scope.ts). - Broadcast sending builds SES parameters in
backend/core-api/src/modules/broadcast/utils/email.ts. - Auth mail (magic links) sends via SendGrid in
backend/core-api/src/modules/auth/utils.ts.
Verify
- Send a test message to a tagged inbound address and confirm it threads to the right conversation.
- Replay the same payload and confirm idempotency (no duplicate conversation).
- Send an outbound test and confirm unsubscribe and tracking links resolve through the gateway URL.
Source references
Was this helpful?