Fluxmail

Configuration

Deployment configuration, encrypted instance settings, local logging, secret files, and telemetry controls.

Fluxmail has two configuration domains. Deployment configuration controls how the process starts. Instance settings control OAuth applications and the license used by a running instance.

Deployment configuration

Deployment settings are resolved in this order:

  1. Built-in defaults
  2. <data dir>/config.toml
  3. Process environment variables

Changes to deployment settings require a restart. Run fluxmail config init to create a starter file with owner-only permissions. Run fluxmail config show to see effective values, their sources, and the paths Fluxmail is using.

FLUXMAIL_DATA_DIR stays outside config.toml because it tells Fluxmail where to find the file. It defaults to ~/.fluxmail, or /data in the Docker image.

A typical file looks like this:

[storage]
database_path = "/var/lib/fluxmail/fluxmail.db"

[server]
port = 8977
public_url = "https://mail.example.com"
trust_proxy = false
max_attachment_mb = 10

[oauth.local]
host = "127.0.0.1"
port = 8976

Fluxmail rejects unknown TOML keys, invalid types, and values outside their allowed ranges. It does not change process.env while resolving settings.

Instance settings

Custom Google and Microsoft OAuth applications and the license key are stored as encrypted records in SQLite. Changes made with fluxmail oauth configure, fluxmail oauth reset, or fluxmail license activate take effect immediately. You do not need to restart the server.

Use fluxmail oauth status to see client IDs, tenant IDs, configuration state, and source categories. Status output never includes client secrets, ciphertext, secret-file paths, or environment values.

Environment variables can override a complete provider group. When a provider comes from the environment, authenticated commands and APIs cannot replace or reset it until you remove the overrides and restart Fluxmail.

  • Google requires both GOOGLE_CLIENT_ID and GOOGLE_CLIENT_SECRET.
  • Microsoft requires MICROSOFT_CLIENT_ID when any Microsoft override is present. MICROSOFT_TENANT_ID defaults to common. Public clients can omit MICROSOFT_CLIENT_SECRET.

Secret storage

Fluxmail encrypts instance settings and provider credentials with AES-256-GCM before writing them to SQLite. Encrypted values use a versioned storage envelope so future releases can migrate the format safely.

The encryption key is resolved from one source:

  1. FLUXMAIL_ENCRYPTION_KEY
  2. FLUXMAIL_ENCRYPTION_KEY_FILE
  3. <data dir>/encryption.key

Fluxmail generates <data dir>/encryption.key with owner-only permissions when no external key is configured. Back up this file with the database. A database backup is not usable without the matching key.

For managed deployments, use *_FILE variables instead of putting secrets directly in the process environment. Fluxmail supports files for FLUXMAIL_ENCRYPTION_KEY, GOOGLE_CLIENT_SECRET, MICROSOFT_CLIENT_SECRET, and FLUXMAIL_LICENSE_KEY. Paths must be absolute. Fluxmail reads UTF-8, removes one final newline, rejects empty files, and leaves externally managed file permissions unchanged.

Import an env file

Fluxmail does not read config.env, .env.local, or .env files. Import settings from an existing file before starting Fluxmail:

fluxmail config migrate --from /absolute/path/to/old.env --dry-run
fluxmail config migrate --from /absolute/path/to/old.env

If the source file sets FLUXMAIL_DATA_DIR, that directory is the migration target. Otherwise, the command uses FLUXMAIL_DATA_DIR from the process environment or the default data directory.

The command validates imported deployment values and checks the database format before writing anything. If the target database already contains encrypted values, you must provide its existing encryption key. Fluxmail will not generate a replacement key for that database. The command writes deployment settings to config.toml, stores OAuth applications and the license in encrypted SQLite records, and preserves the source file. If the encrypted settings step fails, Fluxmail removes only the new config.toml and encryption.key files created by that import. Run fluxmail config show and fluxmail oauth status after the import. Remove the old config.env after you verify the result.

Docker Compose and process-manager env files still work because those tools populate the process environment before Fluxmail starts.

Local logs

Fluxmail writes bounded local logs for failures and low-volume service events. Successful MCP, REST, and CLI operations are not logged. See Local logs for the file location, the 20 MiB disk limit, viewing commands, and privacy notes.

Setting reference

SettingPrimary storageEnvironment overrideDefaultAppliesPurpose
deployment.data_dirExternalFLUXMAIL_DATA_DIR~/.fluxmail (/data in Docker)RestartDirectory for the SQLite database, deployment configuration, and generated encryption key.
storage.database_pathstorage.database_pathFLUXMAIL_DB_PATH<data dir>/fluxmail.dbRestartOverride the SQLite database path.
deployment.encryption_keyExternalFLUXMAIL_ENCRYPTION_KEYFLUXMAIL_ENCRYPTION_KEY_FILEgenerated automaticallyRestartA 64-character hexadecimal key used to encrypt credentials and instance secrets.
server.portserver.portFLUXMAIL_PORT8977RestartHTTP server port.
server.public_urlserver.public_urlFLUXMAIL_PUBLIC_URLhttp://localhost:<FLUXMAIL_PORT>RestartPublic base URL used for HTTP APIs and hosted OAuth callbacks.
server.trust_proxyserver.trust_proxyFLUXMAIL_TRUST_PROXYfalseRestartTrust forwarded protocol and client address headers from a reverse proxy.
oauth.local.portoauth.local.portFLUXMAIL_OAUTH_PORT8976RestartPort for the local OAuth callback listener.
oauth.local.hostoauth.local.hostFLUXMAIL_OAUTH_HOST127.0.0.1RestartBind address for the local OAuth callback listener.
server.max_attachment_mbserver.max_attachment_mbFLUXMAIL_MAX_ATTACHMENT_MB10RestartLargest decoded attachment returned through MCP or REST, from 1 through 25 MB.
logging.levellogging.levelFLUXMAIL_LOG_LEVELinfoRestartMinimum severity retained by the bounded local logger.
logging.destinationlogging.destinationFLUXMAIL_LOG_DESTINATIONbothRestartWrite local logs to both the rotating file and console, or choose file or console.
oauth.google.client_idEncrypted SQLiteGOOGLE_CLIENT_IDFluxmail Desktop OAuth appImmediate; env: restartOverride the built-in Google OAuth client ID.
oauth.google.client_secretEncrypted SQLiteGOOGLE_CLIENT_SECRETGOOGLE_CLIENT_SECRET_FILEFluxmail Desktop OAuth appImmediate; env: restartOverride the built-in Google OAuth client secret. Required with GOOGLE_CLIENT_ID.
oauth.microsoft.client_idEncrypted SQLiteMICROSOFT_CLIENT_IDrequired for OutlookImmediate; env: restartMicrosoft Entra application client ID.
oauth.microsoft.client_secretEncrypted SQLiteMICROSOFT_CLIENT_SECRETMICROSOFT_CLIENT_SECRET_FILErequired for hosted Outlook connectionsImmediate; env: restartMicrosoft Entra application client secret.
oauth.microsoft.tenant_idEncrypted SQLiteMICROSOFT_TENANT_IDcommonImmediate; env: restartMicrosoft Entra tenant ID or verified domain.
license.keyEncrypted SQLiteFLUXMAIL_LICENSE_KEYFLUXMAIL_LICENSE_KEY_FILEnoneImmediate; env: restartPaid-plan license key, normally stored with fluxmail license activate.
telemetry.enabledData directory markerFLUXMAIL_TELEMETRY1Before startupSet to 0 to turn off anonymous CLI, MCP, and REST usage telemetry.
telemetry.do_not_trackData directory markerDO_NOT_TRACKunsetBefore startupSet to 1 to turn off anonymous usage telemetry.

HTTP MCP requests require an API key. REST requests accept an active member session or API key. See Permissions and Authentication and instances.

Telemetry

Fluxmail sends anonymous operation events to its PostHog project by default. Events record the CLI command, MCP tool, or REST operation, plus the outcome, duration, selected feature modes, a random installation ID, and basic runtime information.

Fluxmail never sends command arguments, email or mailbox data, identifiers, search text, file paths, credentials, configuration values, request payloads, provider responses, stack traces, or error text. PostHog person profiles and GeoIP lookup are disabled.

Turn telemetry off for the installation:

fluxmail telemetry disable

You can also set FLUXMAIL_TELEMETRY=0 or DO_NOT_TRACK=1. Any disabling source takes priority over an enabling source. Use fluxmail telemetry status to check the effective state.

Last updated