Data sources
A data source is one mailbox Drillmark polls. One data source maps to one IMAP (or JMAP) account; multiple sources pull from independent inboxes in parallel.
Creating a source
Add a source from Settings in the frontend. Each source needs:
- A label (free text) and the tenant it belongs to.
- IMAP host, port, SSL mode (
plain,starttls,tls). - Credentials. The password is encrypted with
ENCRYPTION_KEY(AES-256-GCM) before it reachesdata_sources.encrypted_password. The plaintext is never persisted. - Folder names (see below).
- Optional OAuth refresh token for providers that need it; stored in
data_sources.oauth_refresh_token_encunder the same key.
Drillmark does not create folders. Create them yourself in the mailbox before enabling the source.
Folder layout
Drillmark expects three folders per mailbox, named by you and stored on the source row:
inbox(or whatever folder DMARC reports land in). Polled on every incoming-queue run.processedfolder. Successfully parsed emails move here.failedfolder. Emails that failed parsing move here. The failed-queue job reattempts them on its own schedule.
A fourth duplicate folder is used when a report has already been ingested (same org name, report id, and date range). Duplicates move there instead of being reprocessed.
What the incoming-queue job does per message
- Fetch the raw MIME.
- Extract each attachment.
- Decompress gzip (only gzip is supported today).
- Parse with the
mail-authlibrary. A parser failure moves the email tofailed. - Check for duplicates by org name + report id + date range. Duplicates move to
duplicate. - Insert the parsed records into Postgres and store the raw blob alongside.
- Move the email to
processed.
Multiple attachments in one email are processed together; if any one attachment fails, the whole email moves to failed.
Supported ingestion
- IMAP with password or OAuth refresh token.
- JMAP (the backend has a JMAP client; the exact matrix of tested providers is operator-verified).
Credentials and rotation
Rotating a mailbox password: update the source from Settings. The frontend re-encrypts with the current ENCRYPTION_KEY and writes the new ciphertext.
Rotating ENCRYPTION_KEY: there is no online primitive. Changing the key invalidates every existing data_sources.encrypted_password and data_sources.oauth_refresh_token_enc row. Operators must disable every source, change the key, and re-enter credentials on each source.
Disabling a source
Toggle is_enabled off. The incoming-queue job skips disabled sources entirely; existing records remain visible in analytics.