# accounts.jsonc

> **Owned by rmfmail. Do not edit this file — your changes will be overwritten the next time the app starts.** The canonical copy ships with each release; this file is a deployed copy for reference. To change account *settings*, edit `accounts.jsonc` (which IS user-editable). To change *documentation*, file an issue.

## What this file documents

`accounts.jsonc` lists every email account rmfmail manages. It lives in your shared GDrive folder (`My Drive/home/.rmfmail/`) so all your devices read the same list.

## Shape

```jsonc
{
  "name": "Bob Frankston",         // optional; default name applied to every account that doesn't override
  "sig": {                         // optional; file-level signature applied to every account that doesn't override
    "text": "—\nBob Frankston\nbob@example.com",
    "html": false
  },
  "signature": "<p>—<br>Bob Frankston</p>",  // optional; file-level legacy-form fallback (used if account has no `sig`/`signature`)
  "accounts": [
    {
      "id": "gmail",                // short tag used in folder paths and the UI
      "email": "you@example.com",   // primary login address
      "name": "Bob Frankston",      // display name (optional if file-level name is set)
      "imap": { "host": "imap.example.com", "port": 993, "tls": true, "auth": "password" },
      "smtp": { "host": "smtp.example.com", "port": 465, "tls": true, "auth": "password" },
      "enabled": true,              // false skips this account at startup
      "identityDomains": ["alias.com"],  // extra domains for Reply-From auto-detect
      "sig": {                      // signature appended to NEW messages only (not replies/forwards)
        "text": "—\nBob Frankston\nbob@example.com",  // \n becomes <br>; HTML-escaped
        "html": false               // reserved; leave false (true would trust `text` as raw HTML)
      },
      "signature": "<p>—<br>Bob Frankston</p>"  // alternative form: HTML string,
                                                // applied to new + reply + forward
    }
  ],
  "keys": {                         // AI provider API keys (optional)
    "anthropic": "",                // sk-ant-api03-...
    "openai": ""                    // sk-...
  }
}
```

## Field rules

- **id** — short identifier. Used in folder paths (e.g. `bob.ma/INBOX`) and as a stable key when accounts.jsonc is edited.
- **email** — primary login. Determines provider auto-config when `imap`/`smtp` are omitted.
- **imap / smtp** — explicit server config. Omit for known providers (Gmail / Outlook / Yahoo / iCloud / Google Workspace are detected from the email domain via MX records).
- **auth** — `"password"` for traditional IMAP/SMTP, `"oauth2"` for Gmail/Google Workspace/Outlook.
- **enabled** — set `false` to keep the account record but skip sync at startup.
- **identityDomains** — domains you treat as "yours" for Reply-From detection. When you Reply, rmfmail looks at the original message's To/Cc; if any address is on one of these domains (exact match OR any subdomain), Reply uses that address as the From. Default if omitted is just the domain of `email` above. Matching is case-insensitive. Subdomain folding is automatic — listing both `frankston.com` and `bobf.frankston.com` is the same as listing just `frankston.com` (the longer entry is dropped at load time). Different domains (`bobfrankston.com` vs `frankston.com` — distinct DNS, no subsumption) stay separate. Example: `"identityDomains": ["bob.ma", "bobfrankston.com", "frankston.com"]`.
- **sig** — per-account signature for *new* messages (skipped on reply / forward / draft-resume). `text` is the plain-text body, HTML-escaped at insertion with `\n` → `<br>`. The optional `html` flag is reserved for "trust as raw HTML"; leave it `false` (or omit) for now. Specify either `sig` or `signature`, not both — `sig` wins if both are present and the message is new. May also be specified at the **file level** (alongside `name`) to apply across every account that doesn't define its own; per-account always wins over file-level.
- **signature** — legacy alternative: an HTML string applied to *new + reply + forward* (positioned before the quote on replies, at the end for new messages). Useful when you want the signature on every outgoing message regardless of context. Also supported at the **file level** as a global fallback.
- **keys.anthropic / keys.openai** — API keys for the AI features (translate / proofread / summarize / autocomplete). Lives at the file's top level alongside `accounts:` so you set it once across all your devices. Generated at console.anthropic.com or platform.openai.com. Provider selection is in `preferences.jsonc`; the key here is read based on which provider is active. Empty string means "not configured" — the AI feature silently no-ops. Local Ollama provider needs no key.

## Notes

- JSONC: `// line comments` and trailing commas are allowed. The parser is lenient.
- Adding/removing accounts requires a daemon restart (`rmfmail -kill && rmfmail`). A status banner reminds you when the file changes.
- For OAuth accounts (Gmail, Google Workspace), the token cache lives in `~/.rmfmail/tokens/` and is per-machine.
