# Welcome to Bryfo (/docs/guides)
**Bryfo** brings all of your standard `IMAP/SMTP`, `Gmail` / `Microsoft 365` (`XOAUTH2`), and custom-domain **Stalwart v1.2.1** mailboxes into one fast, keyboard-first workspace — without exposing raw personal data to external AI models.
## Two Runtime Modes, One MIT Codebase [#two-runtime-modes-one-mit-codebase]
Bryfo ships as a single Go binary (`cmd/bryfo`) paired with a React 19 Progressive Web App, PostgreSQL 17 (`pgvector`), and Valkey 8 (`Asynq`). A single `DEPLOYMENT_MODE` flag selects the operational profile:
| Capability | `self_hosted` (Default) | `cloud` |
| :--- | :--- | :--- |
| **Quotas & Billing** | Unlimited local quotas, billing disabled | Multi-tenant plans (`USD` & `CNY`) + dual-pool credit ledger |
| **Registration** | Invite codes or OIDC Single Sign-On | Open signup with 6-digit SMTP verification + Cloudflare Turnstile |
| **Attachment Storage** | Local disk (`/data/blobs`) or S3/R2 deduplicated blobs | S3/R2 deduplicated blobs + `> 2 MiB` on-demand IMAP streaming |
| **IMAP `IDLE` Push** | Persistent RFC 2177 `IDLE` (25-minute renewal) | Active-window tiered `IDLE` + background Asynq polling |
| **Outbound Network (`netguard`)** | Optional LAN mail/Ollama endpoints (`ForcePublicOnly` on user BYOK) | Strict public-only egress across all sockets |
## Core Pillars [#core-pillars]
1. **Calm Inbox Triage**: Hold strangers in `Screener`, read newsletters in `The Feed`, catch up with twice-daily `AI Briefs`, and track unanswered outbound threads in `Awaiting Reply`.
2. **Bidirectional AI Privacy Shield**: Every outbound prompt passes through 7 deterministic Go validators (`EMAIL`, `PHONE`, `ID_CARD`, `BANK_CARD`, `OTP`, `SECRET`, `IP`) plus your personal regex rules before reaching any cloud model — or use **0-credit BYOK**.
3. **Hybrid Search & Native `/mcp`**: Reciprocal Rank Fusion (`k=60`) across `pg_trgm` trigram search and `pgvector` HNSW embeddings, indexing message bodies and local `.pdf` / Office / text attachments (`<= 2 MiB`), plus a built-in 12-tool MCP server.
# Connecting Mailboxes & Import (/docs/guides/connecting-mail)
Open **Settings (`⌘K` → Settings → Accounts)** or click **Add Account** in the left sidebar to connect multiple email accounts into a unified inbox.
## Connection Methods [#connection-methods]
| Method | Supported Providers | Notes |
| :--- | :--- | :--- |
| **OAuth 2.0 (`XOAUTH2`)** | Google (`Gmail` / Workspace), Microsoft (`Outlook` / Microsoft 365) | One-click authorization when enabled in `/admin/security`. Refresh tokens are encrypted via `KeyRing` and rotated under distributed Valkey locks. |
| **Built-In Presets** | `Gmail`, `Outlook`, `LarkSuite`, `QQ Mail`, `NetEase 163 Mail`, `iCloud Mail` | Pre-fills TLS/STARTTLS ports (`993`, `465`, `587`) and `server_saves_sent` behavior. Always generate an app-specific password or client authorization code when 2FA is active. |
| **Custom IMAP/SMTP** | Fastmail, Migadu, Purelymail, Poste.io, Dovecot/Postfix, Proton Bridge (LAN in `self_hosted`) | Supports implicit `TLS` and `STARTTLS`. Protected against SSRF and DNS rebinding by `netguard`. |
| **Managed Domain Mailboxes** | Domains hosted on `/admin/mailserver` (`Stalwart v1.2.1`) | Self-claim an `@your-domain.example` address directly inside **Add Account** when `self_claim` domains are enabled. |
NetEase Coremail allows `IMAP LOGIN` and `SMTP` submission while blocking `SELECT INBOX` if security checks trigger. In 163 webmail **Settings → POP3/SMTP/IMAP**:
1. Enable **IMAP/SMTP** and use the generated **Client Authorization Password** (never your web login password);
2. Change **Sync Range** from *Last 30 days* to **All**;
3. If `Unsafe Login` appears on the sidebar warning badge, approve the new server IP inside NetEase Security Center.
## Signatures, Relay Aliases & Archive Import [#signatures-relay-aliases--archive-import]
- **Per-Account Profiles**: Customize display names, color badges, HTML/plain-text signatures, `Send-As` aliases, and **Undo Send** buffer (`0–60` seconds, default `8s`).
- **SimpleLogin & Addy.io**: Save your relay API key under **Settings → Accounts** to mint disposable privacy aliases inside the composer.
- **Historical Archive Import (`POST /api/v1/account/import`)**: Upload `.eml`, `.mbox`, or `.zip` archives (`<= 256 MiB`, up to `2,000` messages per upload) with automatic SHA-256 attachment deduplication.
# Calm Triage, The Feed & AI Briefs (/docs/guides/calm-triage)
Bryfo separates urgent human correspondence from automated newsletters, cold outreach, and background notifications.
## First-Time Sender `Screener` [#first-time-sender-screener]
When enabled in the **Screener** folder, messages from unknown external senders (absent from your prior `Sent` recipients, trusted senders, and allowlist) pause outside `Inbox`:
- Suppresses Web Push alerts and skips automatic AI token spend until you decide.
- Click **Allow** or **Block** for either the exact address (`alice@example.com`) or the entire domain (`@example.com`).
## `The Feed` (Newsletter Magazine Stream) [#the-feed-newsletter-magazine-stream]
Approved newsletters and mailing lists (`List-Unsubscribe` headers or AI `newsletters` classification) flow into **The Feed**:
- Continuous magazine-style reading view rendered inside CSP-sandboxed auto-resizing frames (`