Skip to content

Accounts ​

mailarc reads mail from IMAP, POP3 and JMAP servers. This page covers the command line; in the desktop app, choose Accounts instead. Account profiles live in one file per archive, shared by the command line and the desktop app: mailarc/accounts/ARCHIVE_ID.json in your system's settings folder (~/Library/Application Support on macOS, ~/.config on Linux, %APPDATA% on Windows). Every account command and sync uses it, so accounts added on the command line appear in the desktop app and the other way round. --config FILE uses another file instead, and MAILARC_CONFIG_DIR replaces the settings folder. Passwords, and the tokens of Google and Microsoft sign-ins, live in your system's keychain:

  • macOS Keychain;
  • Windows Credential Manager;
  • the Secret Service on Linux, such as GNOME Keyring or KWallet.

Accounts need an archive upgraded to version 2.

An archive takes each mailbox (protocol, server, port and user name) once: adding or registering a second enabled account for it fails with account_already_registered, whichever account file it comes from. To move a mailbox to a new profile, disable the old one first (account edit … --disable).

Add an account ​

sh
mailarc account add ARCHIVE --host imap.example.com --username [email protected]

mailarc asks for the password twice, without showing it, and stores it in the keychain. It accepts a password only typed at a terminal: there is no option, variable or file for it. Adding an account does not connect to the server.

ProtocolOptionDefault port
IMAP--protocol imap (default)993, or 143 with --security starttls
POP3--protocol pop3995, or 110 with --security starttls
JMAP--protocol jmap443 (HTTPS)

Use --port for another port. Every connection is encrypted and checks the server's certificate; mailarc never falls back to an unencrypted connection.

Then record the account in the archive and test it:

sh
mailarc account register ARCHIVE ACCOUNT_ID [--label "Work"]
mailarc account test ARCHIVE ACCOUNT_ID

register writes the account's non-secret settings (server, user name, port, protocol, label) into the archive, so the archive knows where its mail came from. test signs in with the stored password and reports how many mailboxes or messages the server has. It changes nothing.

Gmail and other providers ​

  • Gmail: sign in with Google, or use IMAP with host imap.gmail.com and an app password (Google account, Security, App passwords; this needs 2-Step Verification). mailarc archives All Mail with every message's labels, so each message is downloaded once, whatever its labels. Spam and Trash are skipped unless you ask for them; see Syncing.
  • Microsoft 365 and Outlook.com: password sign-in is usually disabled; sign in with Microsoft.
  • JMAP servers such as Fastmail or Stalwart: use --protocol jmap with the server's host name. mailarc finds the service at https://HOST/.well-known/jmap.

Sign in with Google or Microsoft ​

Instead of a password, mailarc can sign in through your browser. You grant mailarc access on Google's or Microsoft's own page; mailarc never sees your password. It keeps only a refresh token, in the keychain, and uses it to get a short-lived access key for each sync. This works for IMAP.

sh
mailarc account add ARCHIVE --provider google \
    --username [email protected] --client-id CLIENT_ID --client-secret CLIENT_SECRET
mailarc account add ARCHIVE --provider microsoft \
    --username [email protected] --client-id CLIENT_ID

mailarc opens the provider's sign-in page in your browser and waits up to 5 minutes. Sign in with the same account as --username; consent given for another account is refused. Then register and test the account as above. The server, port and encryption come from the provider.

  • --no-browser prints the address instead of opening it. Open it in a browser on the same computer: the provider sends you back to a temporary address on this computer (127.0.0.1 or localhost), which only mailarc listens on.
  • --tenant (Microsoft only) limits sign-in to consumers (personal accounts), organizations (work and school), or one organization's ID or domain. The default, common, allows both.

Register the app first ​

Until mailarc ships with its own registration, you register it with the provider once, as yourself. This gives you the client ID (and for Google the client secret) used above. Neither is a password: Google documents a desktop app's client secret as not confidential, and mailarc keeps both in the config file.

Google (Google Cloud console):

  1. Create a project, then set up the OAuth consent screen: user type External, and add your own address under Test users.
  2. Under Credentials, create an OAuth client ID of type Desktop app. Copy its client ID and client secret.

While the app is in Testing, Google lets its sign-ins last 7 days: after that, sync reports oauth_reauthorization_required and you run account authorize (below). Publishing the app removes the limit, but Gmail's mail scope then requires Google's verification.

Microsoft (Microsoft Entra admin center, App registrations):

  1. Register a new application. Under Supported account types, choose personal accounts, organizational accounts, or both.
  2. Under Authentication, add the platform Mobile and desktop applications with the redirect URI http://localhost.
  3. Under API permissions, add Office 365 Exchange Online, delegated permission IMAP.AccessAsUser.All. Copy the Application (client) ID.

For a work or school account, your organization may have to allow the app, and IMAP must be enabled for your mailbox.

Sign in again ​

A grant ends when you revoke it, change your Google password, or after a provider's limit. Sync then reports oauth_reauthorization_required. Sign in again under the same profile:

sh
mailarc account authorize ARCHIVE ACCOUNT_ID

The new consent must come from the same account. You can revoke mailarc's access at any time in your Google or Microsoft account's security settings; account remove ... --delete-credential deletes the token from the keychain.

What each protocol archives ​

  • IMAP: every folder (or Gmail's All Mail), with flags such as read and flagged, and Gmail labels.
  • POP3: POP3 has only one mailbox and no flags. Its messages appear in one folder named Maildrop, with an unknown delivery date. mailarc never deletes mail from a POP3 server.
  • JMAP: every mailbox, by its full path. An email in several mailboxes appears in each but is stored once. Keywords become flags.

Other account commands ​

CommandWhat it does
account list ARCHIVELists the profiles for this archive
account edit ARCHIVE ID --passwordReplaces the stored password
account authorize ARCHIVE IDSigns in again for a Google or Microsoft account
account edit ... --label "New name"Renames the account in the archive
account edit ... --disable / --enableStops or resumes syncing it
account remove ARCHIVE IDDisables the profile; archived mail stays
account remove ... --delete-credentialAlso deletes the password or token from the keychain
account mailboxes ARCHIVE IDLists the server's folders (IMAP)
account set-reconcile-interval ARCHIVE ID --days NHow often a full check runs; see Syncing

A profile's server, user name, port and protocol never change. To move to another server, add a new account.

Passwords and the keychain ​

  • The config file holds only a random reference to each password, never the password itself. It is tied to one archive, and every account gets its own reference.
  • If sync reports credential_missing, no password or token is stored for the account: run account edit ... --password, or account authorize for a Google or Microsoft sign-in.
  • If it reports credential_store_unavailable, mailarc cannot use the keychain. It may be locked, missing, or not reachable from a background job; see Syncing on a schedule.
  • mailarc never stores a password in a file as a fallback.