Skip to content

IMAP / SMTP setup

IMAP and SMTP are first-party adapters in mxr, shipped alongside Gmail. Any email provider that supports IMAP and SMTP works: Fastmail, ProtonMail (with Bridge), Outlook, Yahoo, your company’s Exchange server, self-hosted Dovecot, anything.

They sync into the same local runtime and IPC surface as Gmail accounts. The daemon still speaks the internal mxr model; IMAP folder semantics are handled in the adapter.

The shortest path is mxr accounts add. It writes the config entry, stores the password in your OS keychain, and runs an authentication round-trip before saving anything:

Terminal window
# Interactive — prompts for host, port, username, password
mxr accounts add imap
mxr accounts add smtp
# Combined IMAP + SMTP — one call, both sides
MXR_IMAP_PASSWORD="$WORK_IMAP_PW" MXR_SMTP_PASSWORD="$WORK_SMTP_PW" \
mxr accounts add imap-smtp \
--account-name work \
--email you@example.com \
--imap-host imap.fastmail.com --imap-username you@example.com \
--smtp-host smtp.fastmail.com --smtp-username you@example.com
# Or split — useful when sync and send live on different servers
MXR_IMAP_PASSWORD="$WORK_IMAP_PW" mxr accounts add imap \
--account-name work \
--imap-host imap.fastmail.com \
--imap-username you@example.com
MXR_SMTP_PASSWORD="$WORK_SMTP_PW" mxr accounts add smtp \
--account-name work \
--smtp-host smtp.fastmail.com \
--smtp-username you@example.com

Passwords resolve in this order: the --imap-password / --smtp-password flag (if present and stdin is not a TTY), then the MXR_IMAP_PASSWORD / MXR_SMTP_PASSWORD environment variables, then an interactive prompt. Pass the env-var form when scripting to keep secrets out of shell history. The credential is written to the OS keychain (Keychain on macOS, Secret Service on Linux) — never to config.toml.

If a password ever goes stale (provider rotated it, you regenerated an app password), re-run mxr accounts repair work to overwrite the keychain entry without touching the rest of the account config.

You can write the config by hand if you prefer. mxr config path shows the file location. The shape is:

[accounts.work]
name = "work"
email = "you@example.com"
[accounts.work.sync]
type = "imap"
host = "imap.example.com"
port = 993
username = "you@example.com"
password_ref = "mxr-work-imap"
use_tls = true
[accounts.work.send]
type = "smtp"
host = "smtp.example.com"
port = 587
username = "you@example.com"
password_ref = "mxr-work-smtp"
use_tls = true

password_ref is the service name the daemon will query in the OS keychain (paired with the username as the account). Store the password yourself with:

Terminal window
# macOS
security add-generic-password -a "you@example.com" -s "mxr-work-imap" -w
# Linux (using secret-tool)
secret-tool store --label="mxr-work-imap" service "mxr-work-imap" account "you@example.com"

The mxr accounts add flow above is the supported path; the manual TOML shape is documented for advanced users only.

ProviderIMAP HostIMAP PortSMTP HostSMTP Port
Fastmailimap.fastmail.com993smtp.fastmail.com587
Migaduimap.migadu.com993smtp.migadu.com587
Outlook / Office 365outlook.office365.com993smtp.office365.com587
Yahooimap.mail.yahoo.com993smtp.mail.yahoo.com587
ProtonMail (Bridge)127.0.0.11143127.0.0.11025
Self-hosted (Dovecot)your-server.com993your-server.com587

All use TLS. Port 993 is IMAP over TLS. Port 587 is SMTP with STARTTLS.

Terminal window
# Check it appears in status
mxr status
# Test connectivity
mxr accounts test work
# Trigger a sync
mxr sync --account work

Add as many accounts as you need — each mxr accounts add invocation appends a new entry to the config:

Terminal window
MXR_IMAP_PASSWORD="$PERSONAL_IMAP_PW" mxr accounts add imap \
--account-name personal \
--imap-host imap.fastmail.com \
--imap-username me@fastmail.com
MXR_SMTP_PASSWORD="$PERSONAL_SMTP_PW" mxr accounts add smtp \
--account-name personal \
--smtp-host smtp.fastmail.com \
--smtp-username me@fastmail.com

You can mix and match: one account on Gmail, another on IMAP/SMTP, a third on something else. They all sync into the same local database and are searchable together.

Manage accounts from the TUI:

  • Ctrl-p then Open Accounts Page

IMAP/SMTP accounts are fully config-backed and editable through the Accounts page.

Some providers require app-specific passwords instead of your regular password when IMAP access is enabled:

  • Fastmail: Settings > Privacy & Security > App Passwords
  • Yahoo: Account Security > Generate app password
  • Outlook with 2FA: Security > App passwords

Use the app password when mxr accounts add prompts for one — never your login password.