Email
Research
Email engineering guide

Fetch email without turning sync into a bottleneck

Fast inbox experiences come from bounded lists, selective fields, durable cursors, and background hydration, not from downloading every body and attachment on every pass.

Research surface only. This guide documents architecture and evaluation criteria; it does not describe a released DewEngine connector.
01
Query shape

Fetch identifiers and list metadata first

Request the smallest fields needed for the inbox view, page deterministically, and hydrate message bodies only when a workflow or user needs them. This reduces provider calls, storage, and exposure of unnecessary message content.

  • Provider ID and thread ID
  • Sender, recipients, subject, timestamps
  • Flags, labels, and folder location
  • Attachment metadata before binary content
02
Change tracking

Use provider cursors rather than repeated date scans

Gmail history IDs and Microsoft Graph delta links encode provider state more reliably than a last-seen timestamp. Keep each cursor scoped to its mailbox or folder and commit it only after corresponding changes are durable.

03
Concurrency

Bound work per mailbox

Use a per-account lease so two workers do not advance the same cursor simultaneously. Apply backpressure across large tenants, honor Retry-After responses, and isolate one failing mailbox from the rest of the queue.

04
Correctness

Optimize without losing deletes or moves

A thin cache still needs tombstones, folder changes, and periodic reconciliation. Measure sync lag and cursor age, then trigger a controlled full rebuild when provider state says incremental recovery is impossible.

  • Sync lag service level
  • Delete and move reconciliation
  • Full-resync budget and progress
Questions

Before you build.

Should message bodies be stored locally?+

Only when the product needs them and its retention policy permits it. A metadata-first cache with on-demand body retrieval is often safer and cheaper.

Is polling always wrong?+

No. Provider notifications can be incomplete or expire, so low-frequency reconciliation polling is a useful safety net. Tight repeated full-mailbox polling is the problem.

Can I use DewEngine's email connectors today?+

Not yet. Gmail, Microsoft Graph, and IMAP/SMTP connectors are planned. This guide documents the intended architecture and the provider requirements a production release must satisfy.

Build with us

Does this match the workflow your users need?

DewEngine is in development. Real use cases decide what ships first.

Share your use case