IMAP and SMTP mail accounts

Metnos can use mailboxes from non-Google providers. Standard mail uses IMAP for reading and SMTP for sending; Google Workspace remains a separate backend for Gmail-specific functions.

Account identity

Each account has a stable name, such as work. Its encrypted vault binding is smtp_work; mail executors receive account="work". account="all" reads all configured accounts and aggregates the results; an explicit list of names is also valid.

Preferred configuration

Ask Metnos with a request like this example: “Explain how to configure a non-Google mail account named work with IMAP and SMTP, without putting the password in the message.”

The encrypted smtp_<name> record contains:

FieldMeaning
user, passwordMailbox credentials.
imap_host, imap_portRead server; typical port 993.
smtp_host, smtp_portSend server; typical SMTPS port 465. It may be omitted for a read-only account.
verify_tlsTLS verification, enabled by default; disabling it requires an explicit administrative decision.

Contract example, with secret values replaced by placeholders:

set_credentials(
  binding="smtp_work",
  fields={
    "user": "person@example.test",
    "password": "<password>",
    "imap_host": "imap.example.test",
    "imap_port": 993,
    "smtp_host": "smtp.example.test",
    "smtp_port": 465,
    "verify_tls": true
  }
)

During an interactive installation, the Sensitive data phase can create one or more accounts. After installation, the same structure can be stored with set_credentials; values enter the local encrypted vault, while responses and telemetry expose metadata only.

Compatibility with earlier configurations

A mode-0600 file at ~/.config/metnos/mail/<name>.env remains accepted with fields HOST_IMAP, PORT_IMAP, HOST_SMTP, PORT_SMTP, USER, PASS, and VERIFY_TLS. The encrypted vault takes precedence; the file is a compatibility and migration path.

Boundaries

read_messages reads IMAP; send_messages sends SMTP; move_messages manages IMAP folders. Gmail labels, Gmail threads, and other provider-specific features remain in the Google Workspace backend.

Moving a message to Trash never expunges an entire folder. Metnos uses the server's atomic MOVE operation when available; otherwise it proceeds only when it can copy, mark, and expunge exactly the selected UIDs. If the server cannot provide those guarantees, the operation fails without changing the mailbox. UIDs remain bound to their source account and folder: results from different accounts are never forwarded to one ambiguous move. When IMAP UIDs are supplied directly instead of coming from a preceding read step, both the account and source folder must be explicit. Metnos rejects an unbound UID before contacting the backend; it never guesses the default mailbox. This requirement does not apply to Gmail message IDs, whose provider supplies their own identity scope.

Passwords must not be placed in documentation, manifests, or logs. When supplied through a chat credential flow, they are extracted before the planner, encrypted, and replaced by a redaction marker.