Introducing a new way to review your PRs.

Read the announcement

twentyhq / twenty

The open alternative to Salesforce, designed for AI.

View on GitHub

22 documents · Updated Nov 20, 2026

docs / connected-accounts-messaging

Connected accounts and messaging sync

Connected accounts bring mail and calendar activity into a workspace. They let users sync provider data, send mail, create events, receive change notices, match participants to CRM people, and keep meeting and delivery history linked to workspace records.

Account and channel model

Connected accounts

A connected account is an external identity that can provide mail, calendar data, or both. It holds the identity and connection state while separate mail and calendar channels hold the rules and progress for each source. Google, Microsoft, and direct IMAP, SMTP, and CalDAV connections use this model.

Accounts can belong to one user or to the workspace. Callers can use only accounts they own or accounts shared with their workspace. An archived account keeps its stored data but stops new sync work until it is connected again. Tokens stay protected while public account data exposes only identity and connection status. Provider expiry data controls token refresh; providers without expiry data use a bounded estimate. packages/…/connected-account.entity.ts• L27-161 packages/…/connected-account-scope.enum.ts• L5-8 packages/…/connected-account-refresh-tokens.service.ts• L51-182 packages/…/google-oauth2-client.provider.spec.ts• L121-169

References: packages/…/ConnectedAccount.ts• L6-31 packages/…/connected-account.entity.ts• L27-161 packages/…/connected-account-scope.enum.ts• L5-8 packages/…/connected-account-refresh-tokens.service.ts• L51-182 packages/…/google-oauth2-client.provider.spec.ts• L121-169

Mail and calendar channels

A mail channel is the workspace view of one mail source. It defines source identity, folders, visibility, filtering, contact policy, and sync state. A calendar channel provides the same boundary for one calendar source and also stores event visibility and participant rules. Both channel types belong to a connected account and can have a provider watch.

The shared message or calendar record is separate from its source association. This lets a record remain when one source or folder disappears, and it lets the same event or message be represented by more than one source. Direct connections create only the channels supported by their IMAP, SMTP, and CalDAV settings. packages/…/message-channel.entity.ts• L51-176 packages/…/calendar-channel.entity.ts• L39-176 packages/…/message-channel-message-association.workspace-entity.ts• L7-17

References: packages/…/message-channel.entity.ts• L51-176 packages/…/calendar-channel.entity.ts• L39-176 packages/…/message-channel-message-association.workspace-entity.ts• L7-17 packages/…/channel-sync.service.ts• L124-181 packages/…/imap-smtp-caldav-apis.service.ts• L100-183

Account settings

Account settings let users connect, inspect, reconnect, and remove external identities. Mail settings control folders, visibility, contact creation, group mail, and blocked addresses or domains. Calendar settings control event visibility and participant contact creation. These choices determine which external activity becomes workspace data.

The same settings surface also supports application-owned connections. Application settings can add provider connections and user-scoped variables while keeping workspace administration actions separate from member actions. packages/…/SettingsBuiltInAccountApp.tsx• L32-85 packages/…/SettingsAccountsMessageChannelDetails.tsx• L63-157 packages/…/SettingsApplicationPreferencesDetail.tsx• L45-111

References: packages/…/SettingsBuiltInAccountApp.tsx• L32-85 packages/…/SettingsAccountsMessageChannelDetails.tsx• L63-157 packages/…/SettingsAccountsCalendarChannelDetails.tsx• L39-76 packages/…/SettingsAccountsBlocklistSection.tsx• L24-80 packages/…/SettingsApplicationPreferencesDetail.tsx• L45-111

Synchronization model

Sync flow

Each enabled channel uses a queued list stage followed by a detail and save stage. Mail lists changed message identities and folder changes before fetching message details. Calendar lists changed event identities before fetching event details. The save stage applies workspace rules, writes shared records and source associations, and advances the provider position.

Provider notices, scheduled work, recovery work, and manual sync all enter this same path. This keeps filtering and save behavior consistent across an initial sync and a later change.

This diagram shows how an external change becomes workspace activity.

flowchart LR
  A[Provider change] --> B[Notice, schedule, or manual sync]
  B --> C[Channel state check]
  C --> D[List changed identities]
  D --> E[Fetch details]
  E --> F[Apply channel rules]
  F --> G[Save workspace records]
  G --> H[Advance provider position]

References: packages/…/channel-sync.service.ts• L60-181 packages/…/webhook-sync-trigger.service.ts• L33-140 packages/…/messaging-message-list-fetch.service.ts• L60-303 packages/…/messaging-messages-import.service.ts• L59-274 packages/…/calendar-fetch-events.service.ts• L37-130

Sync state and recovery

Sync state records whether a channel is waiting, active, complete, throttled, or failed. Scheduler claims prevent two workers from taking the same stage. Stale work returns to a pending state, and temporary provider or database errors can retry until the retry limit. Permission, token, and certificate failures require account repair or reconnect.

Provider positions protect incremental sync. An invalid position starts a full pass. Gmail history includes added messages, deleted messages, and label changes, so a label change can bring a message back into the import path. Direct IMAP sources also derive a usable mailbox position when a server does not provide UIDNEXT. packages/…/gmail-get-history.service.ts• L15-119 packages/…/messaging-message-list-fetch.service.ts• L141-255

Filtering happens before external activity becomes visible. Mail rules cover folders, aliases, blocked addresses, group mail, internal mail, and provider spam signals. Calendar rules cover channel visibility, private events, and blocklists. A blocklist change removes affected associations or resets the channel for reimport.

References: packages/…/message-channel-sync-status.service.ts• L59-341 packages/…/messaging-import-exception-handler.service.ts• L44-285 packages/…/gmail-get-history.service.ts• L15-119 packages/…/messaging-message-list-fetch.service.ts• L141-255 packages/…/messaging-messages-import.service.ts• L165-286 packages/…/calendar-events-import.service.ts• L104-184

Mail folders

Provider folders become workspace folders linked to a mail source. Folder changes are applied before message import, and message associations then add or replace their folder links. Removing a message from one folder does not remove its source association when another folder or source still keeps it visible.

Gmail selected-folder rules and Microsoft folder trees map provider behavior into this common workspace view. A full sync compares the provider result with the channel associations and removes only source records that are absent from the provider result. packages/…/messaging-message-folder-association.service.ts• L16-93 packages/…/messaging-message-list-fetch.service.ts• L216-255 packages/…/filter-gmail-messages-by-folder-policy.util.ts• L8-50

References: packages/…/sync-message-folders.service.ts• L40-196 packages/…/messaging-message-folder-association.service.ts• L16-93 packages/…/messaging-message-list-fetch.service.ts• L216-255 packages/…/filter-gmail-messages-by-folder-policy.util.ts• L8-50

Messaging and calendar data

Message records and threads

Imported and sent mail becomes messages grouped into threads. A message has content, delivery and draft state, participants, provider identity, and optional attachments. Source associations keep provider identities beside the shared message and thread records.

The save path matches stable provider identities before creating records. It can refresh a synced draft when the provider reports that it was sent. It also uses a safe text boundary that removes quoted reply history and unsafe HTML before the content is exposed to users. packages/…/messaging-message.service.ts• L54-377 packages/…/quote-shape-sweep.spec.ts• L279-320

Imported and sent messages use the same participant, folder, attachment, and contact path. Attachment metadata is filtered before save, so inline images and mail-system files such as calendar invite files and winmail.dat do not become workspace attachments. Supported provider attachments can remain as remote files and are fetched from the connected account only when needed. A per-account fetch limit protects provider access. Attachment storage does not discard the message when the remote file is unavailable. When a source association is removed, cleanup removes the shared message or thread only after no other source still references it. packages/…/messaging-save-messages-and-enqueue-contact-creation.service.ts• L213-257 packages/…/messaging-message-attachment.service.ts• L106-191 packages/…/messaging-remote-attachment.service.ts• L53-183 packages/…/messaging-message-cleaner.service.ts• L29-141 packages/…/messaging-message-cleaner.service.ts• L185-281

The provider drivers normalize Gmail, Microsoft, and IMAP attachment data into one metadata shape. They then fetch content through the connected account when a user reads a remote file. This keeps message import light while preserving access to supported files.

References: packages/…/message.workspace-entity.ts• L9-24 packages/…/message-thread.workspace-entity.ts• L6-10 packages/…/messaging-message.service.ts• L54-377 packages/…/messaging-save-messages-and-enqueue-contact-creation.service.ts• L75-285 packages/…/messaging-message-attachment.service.ts• L41-191 packages/…/messaging-remote-attachment.service.ts• L46-183 packages/…/filter-importable-message-attachments.util.ts• L7-27 packages/…/messaging-message-cleaner.service.ts• L29-141 packages/…/messaging-message-cleaner.service.ts• L185-281

Calendar event records

Calendar sync creates shared event records with time, title, location, recurrence, cancellation, conference data, and participants. Source associations retain provider identity. Events from different channels can share one record when their provider identity or calendar UID proves that they are the same event.

CalDAV supports both incremental collection sync and a broader change scan when a server lacks the needed report. An invalid sync token triggers a full resync. CalDAV data can arrive in several response shapes, so the calendar path extracts the iCalendar data before it reads event fields. It imports only events in the supported time window and keeps organizer, attendee, display name, and response state.

Creating an event requires a writable calendar and a usable connected account. The CalDAV path writes the event, uses the server resource identity for later reconciliation, and returns the created event in the same shape used by import. When the server does not schedule invitations, the account’s SMTP connection sends the invitation message. packages/…/caldav-create-event.service.ts• L32-179 packages/…/caldav-invitation.service.ts• L22-107 packages/…/caldav-fetch-events.service.ts• L45-123 packages/…/caldav-fetch-events.service.ts• L201-297

Removing a calendar source deletes its source associations in pages. The shared event is deleted only when no calendar channel still references it. packages/…/calendar-event-cleaner.service.ts• L19-117

References: packages/…/calendar-event.workspace-entity.ts• L9-28 packages/…/calendar-save-events.service.ts• L36-296 packages/…/caldav-fetch-events.service.ts• L45-123 packages/…/caldav-fetch-events.service.ts• L201-365 packages/…/extract-ical-data.util.ts• L6-27 packages/…/icalDataExtractPropertyValue.ts• L7-44 packages/…/extract-attendees-from-event.util.ts• L8-33 packages/…/extract-organizer-from-event.util.ts• L8-27 packages/…/is-event-in-time-range.util.ts• L5-18 packages/…/is-invalid-sync-token-response.util.ts• L5-19 packages/…/caldav-create-event.service.ts• L32-179 packages/…/caldav-invitation.service.ts• L22-107 packages/…/calendar-event-cleaner.service.ts• L19-117

Participant matching and access

Participant identity and matching

A participant is a person or address involved in a message or event. The system saves the provider handle and display name first, then links the participant to a CRM person or workspace member. This order keeps a missing match from blocking sync.

Email channels match email handles. Application channels use supplied targets or a configured person handle field instead of forcing non-email values into an email match. Calendar participants use the same save-then-match pattern and can create contacts when channel policy permits it. Changes to a person’s email or custom handle queue fresh matching work. packages/…/messaging-save-messages-and-enqueue-contact-creation.service.ts• L202-285 packages/…/messaging-message-participant.service.ts• L26-190 packages/…/calendar-event-participant.service.ts• L49-153

Contact creation is policy-driven. Mail can exclude drafts, the connected identity, blocked addresses, group addresses, and non-professional addresses. Calendar channels can enqueue contact creation for event participants. packages/…/messaging-save-messages-and-enqueue-contact-creation.service.ts• L138-257

This diagram shows how a provider handle becomes a CRM link.

flowchart LR
  A[Provider handle] --> B[Saved participant]
  B --> C{Match identity}
  C --> D[CRM person]
  C --> E[Workspace member]
  B --> F[Optional contact creation]
  D --> G[Re-match after identity change]

References: packages/…/message-participant.workspace-entity.ts• L10-22 packages/…/calendar-event-participant.workspace-entity.ts• L7-25 packages/…/messaging-save-messages-and-enqueue-contact-creation.service.ts• L138-285 packages/…/messaging-message-participant.service.ts• L26-190 packages/…/calendar-event-participant.service.ts• L49-153 packages/…/message-participant-person.listener.ts• L41-231

Messages and calendar events can target a person, company, or opportunity. A target records whether the link came from matching or from a user. Manual links therefore survive automatic reconciliation.

Channel visibility controls the detail a member can read. Shared calendars expose event details. Private calendar data and restricted message content are limited by account ownership and channel policy. Attachments use the message rule, so a hidden message cannot reveal its files through a nested attachment query. A sent-message link also requires the caller to have update access to the target record before the system stores the manual link. packages/…/apply-messages-visibility-restrictions.service.ts• L21-198 packages/…/apply-attachments-visibility-restrictions.service.ts• L18-111 packages/…/apply-calendar-events-visibility-restrictions.service.ts• L21-155 packages/…/sent-message-record-link.service.ts• L19-77

References: packages/…/message-thread-target.workspace-entity.ts• L8-19 packages/…/calendar-event-target.workspace-entity.ts• L8-19 packages/…/apply-messages-visibility-restrictions.service.ts• L21-198 packages/…/apply-attachments-visibility-restrictions.service.ts• L18-111 packages/…/apply-calendar-events-visibility-restrictions.service.ts• L21-155 packages/…/sent-message-record-link.service.ts• L19-77

Provider webhooks

Notification intake

Provider webhooks accept change notices for supported mail and calendar channels. The endpoint checks the provider handshake or state value, identifies the stored account or channel, and queues normal sync work. A notice does not write workspace records directly.

Google mail notices use the notified address. Google Calendar and Microsoft notices use stored channel or subscription identity and client state. This lookup prevents a valid notice for one source from starting work for another source. packages/…/connected-account-sync-webhooks.controller.ts• L30-107 packages/…/google-messaging-notification.handler.ts• L49-98 packages/…/microsoft-messaging-notification.handler.ts• L44-118

References: packages/…/connected-account-sync-webhooks.controller.ts• L30-107 packages/…/google-messaging-notification.handler.ts• L49-98 packages/…/microsoft-messaging-notification.handler.ts• L44-118 packages/…/webhook-sync-trigger.service.ts• L33-140

Watch lifecycle

Each supported mail or calendar channel can own one provider watch. The system creates watches after setup, renews them before expiry, and recreates them after provider removal. It creates a replacement before stopping the old watch to reduce missed changes. Claims and client state keep an old job from changing a newer watch.

Workspace suspension or deletion revokes watches. Reactivation creates watches again when needed. Disconnect and channel deletion stop provider watches before account or source data is removed. packages/…/messaging-webhook-subscription.service.ts• L42-165 packages/…/calendar-webhook-subscription.service.ts• L42-165 packages/…/webhook-subscription-workspace-sync.service.ts• L34-59

References: packages/…/messaging-webhook-subscription.service.ts• L42-165 packages/…/calendar-webhook-subscription.service.ts• L42-165 packages/…/webhook-subscription-status.service.ts• L31-159 packages/…/webhook-subscription-workspace-sync.service.ts• L34-59 packages/…/connected-account-metadata.service.ts• L471-673

Recordings

Call recordings

A call recording is a meeting record linked to a calendar event. It tracks requested and processing state plus available video, audio, transcript, and summary output. Calendar activity views present the recording and summary as part of the meeting history.

References: packages/…/call-recording.workspace-entity.ts• L10-25 packages/…/call-recording-status.enum.ts• L1-9 packages/…/standard-calendar-event-page-layout.config.ts• L45-109

Email delivery

Personal email

Personal email uses a connected account selected by the caller. The send boundary checks account access and the sender identity, preserves reply headers, sends through the provider path, and can persist a successful send into the matching workspace thread.

Sent mail enters the same message save path as imported mail. It carries the sender and recipient roles, uses provider IDs when available, falls back to the message header when they are absent, and keeps replies under the parent thread identity when the provider does not return a thread ID. Attachments are stored when enabled; failed attachment storage does not discard the sent message. packages/…/send-email.service.ts• L21-103 packages/…/format-sent-message.util.ts• L13-65 packages/…/sent-message-persistence.service.ts• L38-177

Replies use the channel that owns the thread. A synced draft can be sent or removed only through an association on the selected account’s channels. Direct accounts use SMTP and can append sent mail through IMAP. Email-group accounts use a verified outbound domain and do not provide mailbox draft behavior. packages/…/sent-message-record-link.service.ts• L19-77 packages/…/messaging-send-manager.module.ts• L47-60

References: packages/…/send-email.service.ts• L21-103 packages/…/format-sent-message.util.ts• L13-65 packages/…/sent-message-persistence.service.ts• L38-177 packages/…/sent-message-record-link.service.ts• L19-77 packages/…/messaging-send-manager.module.ts• L47-60 packages/…/sent-message-persistence.service.spec.ts• L74-153

Message lists and campaign email

A message list is a reusable audience of CRM people. List changes are permission-checked and protected from concurrent mutation. Campaign email uses that audience with a verified shared sender, an unsubscribe topic, and a rich message body. It can send now or at a scheduled time.

The final send resolves the audience again. It applies hard, global, topic, and tracking suppressions before it creates recipient delivery work. Workers retry temporary failures and settle each recipient as sent, skipped, or failed. Draft validation rejects unknown variables and invalid email documents. packages/…/message-list-duplication.service.ts• L42-204 packages/…/add-people-to-message-list-job.service.ts• L42-154 packages/…/message-campaign-audience.service.ts• L27-177 packages/…/message-campaign-lifecycle.service.ts• L193-346

References: packages/…/message-list.resolver.ts• L20-83 packages/…/message-list-duplication.service.ts• L42-204 packages/…/add-people-to-message-list-job.service.ts• L42-154 packages/…/message-campaign-audience.service.ts• L27-177 packages/…/message-campaign-draft.service.ts• L63-205 packages/…/message-campaign-lifecycle.service.ts• L193-346

Delivery events and inbound email

Delivery webhooks report inbound mail, delivery state, bounces, and complaints. Permanent bounces and complaints suppress the affected address. Inbound mail is accepted only when its configured source and recipient match an email-group channel.

The inbound path restores a thread from reply headers when the referenced message belongs to the target channel. It rejects provider spam and excluded group mail, saves accepted messages through the normal participant and contact path, and cleans up the provider source after processing. The result distinguishes imported, excluded, unmatched, and unconfigured mail. packages/…/inbound-email-import.service.ts• L45-158 packages/…/inbound-email-import.service.ts• L161-246

This diagram shows the main outbound and inbound effects of email delivery.

flowchart LR
  A[Connected account or verified domain] --> B[Outbound email]
  B --> C[Recipient provider]
  C --> D[Delivery webhook]
  D --> E[Delivery state or suppression]
  F[Inbound provider] --> G[Inbound webhook]
  G --> H[Email-group match]
  H --> I[Queued message import]
  I --> J[Thread and participant records]

References: packages/…/messaging-webhooks.controller.ts• L33-83 packages/…/inbound-mail-handler.service.ts• L26-50 packages/…/outbound-suppression-handler.service.ts• L19-49 packages/…/inbound-email-import.service.ts• L45-246

This page covers connected identities, provider data, watches, participant links, recordings, and email delivery. For the wider account and external-channel model, see External integrations. For browser-based provider connections and extension delivery, see Extension integrations.

Change checklist

When these files or sections are changed, remember to consider these:

  • Keep account scope, caller access, token refresh, archive state, aliases, and reconnect state aligned across account queries, provider clients, and settings.
  • Keep provider capability rules aligned across channel creation, calendar creation, sync, sender selection, and outbound delivery.
  • Keep list and import stages aligned with queue claims, cursor updates, full-sync comparison, stale recovery, retry state, and cleanup.
  • Keep source associations separate from folder links. Removing one source must not remove a shared message or event still used by another source.
  • Keep message and calendar provider identities aligned with cross-channel sharing and orphan cleanup.
  • Keep CalDAV creation identity aligned with CalDAV import identity. A created event must reconcile with a later sync instead of becoming a duplicate.
  • Keep CalDAV invitation behavior aligned with server scheduling support and the account SMTP capability.
  • Keep Gmail history changes aligned with label policy and message association updates.
  • Keep participant handles, roles, application targets, contact policy, and rematch events aligned.
  • Keep message, attachment, calendar, and nested-record visibility rules aligned so restricted content cannot bypass its channel.
  • Keep sent-message formatting, thread fallback IDs, attachment ownership, common message save, and CRM record-link permissions aligned.
  • Keep campaign audience resolution, suppression checks, delivery claims, and final campaign state aligned.
  • Keep notification lookup keys, client-state checks, watch replacement, workspace suspension, and disconnect cleanup aligned.
  • Keep inbound recipient matching and referenced-message lookup scoped to the target email-group channel.

Important failure modes

TriggerConsequenceGuard
Account scope rules differ between the database filter and caller checkA caller can use another user’s private account or lose access to a shared accountKeep account visibility and usability checks as one contract
A provider token is used after its real expirySync and send fail until the account reconnectsRefresh from provider expiry data with a bounded margin
A provider cursor or CalDAV sync token becomes invalidIncremental sync can miss changes or stopClear the position and run a full pass
A full sync removes a source association without checking other sourcesA shared message or event is deleted too earlyDelete shared records only after orphan checks
A CalDAV created event uses a different identity from importThe next sync creates a duplicate eventReconcile with the server resource identity returned by the provider
A CalDAV server schedules invitations but the client also sends themInvitees can receive duplicate invitationsSend an invitation only when the server does not auto-schedule
Gmail label changes are ignoredA message can remain out of sync with selected-folder policyTreat label changes as message changes
A sync stage remains active after a worker stopsThe channel receives no later workReturn stale stages to pending state
A provider notice lacks the stored identity or valid stateNo sync starts or the wrong channel is touchedMatch account, channel, subscription, and client state
A blocked or spam message reaches an email groupUnwanted mail becomes CRM activityApply source, spam, group, and blocklist rules before save
A participant is matched before it is savedOne failed match can block the whole importSave first and match as a later step
A restricted message is read through its attachmentA member can see hidden file dataApply message visibility to attachment results
A remote attachment is fetched without its source association or account throttleThe file cannot be found or provider access can be overusedResolve the association first and throttle fetches per connected account
An attachment filter treats inline or mail-system files as user filesWorkspace records contain duplicate or unusable attachment dataNormalize metadata and filter inline images and known mail-system files
A sent message uses an empty or wrong thread identityReplies split into new threads or unrelated mail is mergedUse provider IDs, header fallback, and parent-thread identity rules
An attachment upload fails during sent-message persistenceThe sent message is lost or temporary files remainKeep message save independent and clean unclaimed files
A campaign audience is not resolved at final sendThe campaign sends to changed or suppressed recipientsRecompute audience and suppressions during send preparation
An inbound recipient or referenced message does not belong to the target group channelInbound mail is not imported into its intended threadRequire a configured recipient and channel-scoped association

Key files

FileWhy to read it
packages/…/connected-account.entity.tsDefines the external identity and its channel relationship.
packages/…/connected-account-refresh-tokens.service.tsShows token reuse, refresh, protection, and persistence.
packages/…/message-channel.entity.tsDefines mail source rules, visibility, and sync state.
packages/…/calendar-channel.entity.tsDefines calendar source rules and sync state.
packages/…/channel-sync.service.tsShows how account readiness starts channel work.
packages/…/messaging-message-list-fetch.service.tsShows list changes, cursor progress, full-sync comparison, and cleanup handoff.
packages/…/messaging-messages-import.service.tsShows filtering and batch message import.
packages/…/messaging-save-messages-and-enqueue-contact-creation.service.tsDefines the shared message save, participant, attachment, and contact path.
packages/…/messaging-message-attachment.service.tsShows attachment filtering, remote-file records, and attachment ownership.
packages/…/messaging-remote-attachment.service.tsShows on-demand provider attachment reads and account throttling.
packages/…/messaging-message-cleaner.service.tsShows association removal and orphan message and thread cleanup.
packages/…/caldav-fetch-events.service.tsShows CalDAV change listing, token recovery, and event fetch scope.
packages/…/caldav-create-event.service.tsShows CalDAV event creation and later-sync identity handling.
packages/…/caldav-invitation.service.tsShows CalDAV organizer and invitation behavior.
packages/…/calendar-event-cleaner.service.tsShows source removal and event orphan cleanup.
packages/…/connected-account-sync-webhooks.controller.tsDefines provider notification entry points.
packages/…/webhook-subscription-status.service.tsShows watch claim, expiry, settlement, and recreation rules.
packages/…/call-recording.workspace-entity.tsDefines the meeting recording record and event link.
packages/…/send-email.service.tsDefines the shared personal email send and persistence boundary.
packages/…/sent-message-persistence.service.tsShows how delivered mail enters the shared message model and handles attachments.
packages/…/format-sent-message.util.tsShows sent-message participants and thread identity fallbacks.
packages/…/message-campaign-audience.service.tsShows campaign audience and suppression resolution.
packages/…/message-campaign-lifecycle.service.tsShows campaign delivery recovery and terminal state handling.
packages/…/inbound-email-import.service.tsShows inbound recipient matching, reply threading, filtering, and import outcomes.