Skip to main content

Email Scanning

Once a mailbox is connected, Campbooks keeps it in sync in the background and processes the messages and attachments it finds.

How scanning works

  1. Scan — a background job fetches new messages from the provider's API.
  2. Deduplicate — messages are matched by provider message ID, so a message is never ingested twice.
  3. Process — each new message is analyzed (triage) and its attachments are downloaded.
  4. Create documents — every attachment becomes a Document and is queued for AI classification.

Automatic scanning

Scanning runs on a schedule with no setup. A fast incremental sync runs every minute, and a fuller sweep runs every 15 minutes as a safety net.

The incremental sync uses each provider's native delta mechanism rather than re-walking the whole mailbox, so it's quick and light:

ProviderIncremental strategy
Google WorkspaceGmail History API
Microsoft 365Microsoft Graph delta queries
Zoho MailWindowed fetch of recent messages

Manual scanning

You can also trigger a scan yourself: go to Email Scans and start a new scan for a chosen account. Each scan is recorded so you have an audit trail of what ran and when.

Scan status

StatusMeaning
PendingScan queued, waiting to run
RunningScan in progress
CompletedScan finished successfully
FailedScan encountered an error

What happens to each message

As messages arrive, AI triage categorizes them, assigns a priority, and writes a short summary, so the inbox sorts itself and the things that need you rise to the top. (Triage runs only when an AI provider is configured — otherwise messages still sync, just without the AI signals.)

Attachments go through a processing pipeline:

  1. Download — files are stored via Active Storage (local disk or S3).
  2. Create — a Document record is created for each attachment.
  3. Classify — AI determines the document type and extracts its fields. See Document Classification.
  4. Index — the document is indexed for search.

Viewing messages

Scanned messages appear in the Inbox and Email Messages views, where you can read the full message and its attachments, reply, tag and organize, move messages between folders, and act on AI-generated suggestions. Workflows can also fire automatically on each incoming message — see Workflows.