Skip to main content

Agent-first IMAP CLI for safe email search, read, attachment download, and draft creation

Project description

imap-agent-cli

imap-agent-cli is an agent-first IMAP CLI for safe email search, read, attachment download, and draft creation.

It can inspect mailboxes and append messages to Drafts. It cannot send email, delete messages, move messages, archive messages, change labels, alter flags, or mark messages read/unread.

Status

This repo is under active development. The behavior target is defined in spec.md.

Quick Start

Single-profile env-var setup:

IMAP_AGENT_CLI_HOST=imap.example.com
IMAP_AGENT_CLI_PORT=993
IMAP_AGENT_CLI_USERNAME=me@example.com
IMAP_AGENT_CLI_PASSWORD=...
IMAP_AGENT_CLI_TLS=true

Local development:

uv run ./imap_agent_cli.py --help
uv run ./imap_agent_cli.py folders
uv run ./imap_agent_cli.py search --subject invoice

Packaged execution:

uvx imap-agent-cli --help

Examples

imap-agent-cli folders
imap-agent-cli search --folder INBOX --subject "invoice" --max-results 10
imap-agent-cli read --folder INBOX --uid 12345 --body-format html
imap-agent-cli attachments --folder INBOX --uid 12345
imap-agent-cli attachments download --folder INBOX --uid 12345 --part-id 2 --output-dir C:\tmp\email-attachments
imap-agent-cli draft create --to person@example.com --subject "Hello" --body "Draft only."
imap-agent-cli draft reply --folder INBOX --uid 12345 --body "Thanks. I will review this."

All command payloads are JSON on stdout. Diagnostics and errors go to stderr.

Config

Create a starter config:

imap-agent-cli config init

Add a named profile:

imap-agent-cli config add-profile work --host imap.example.com --port 993 --username me@example.com --password-env IMAP_AGENT_CLI_WORK_PASSWORD
imap-agent-cli config set-default-profile work

Config path:

~/.imap-agent-cli/config.toml

Secrets should stay in environment variables, not the config file.

Safety Boundary

Allowed:

  • list folders
  • search messages
  • read messages with no-seen fetch behavior
  • list/download attachments only when requested
  • append new messages to Drafts

Not allowed:

  • send
  • delete
  • move
  • archive
  • flag/star
  • mark read/unread
  • create/delete/rename folders

Testing

No-network unit tests:

python -m unittest discover -v

Package build:

uv build --no-sources

The spec targets pymap for future local IMAP integration tests on Windows without Docker.

Opt-in local IMAP integration test:

$env:IMAP_AGENT_CLI_TEST_PYMAP = "1"
uv run --extra test python -m unittest tests.test_pymap_integration -v

The integration test starts pymap dict --demo-data locally and logs in with demouser / demopass.

Publishing

The GitHub Actions workflow is .github/workflows/publish.yml.

PyPI Trusted Publishing values:

Project: imap-agent-cli
Owner: pseudosavant
Repository: imap-agent-cli
Workflow: publish.yml
Environment: pypi

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

imap_agent_cli-0.1.1.tar.gz (26.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

imap_agent_cli-0.1.1-py3-none-any.whl (19.0 kB view details)

Uploaded Python 3

File details

Details for the file imap_agent_cli-0.1.1.tar.gz.

File metadata

  • Download URL: imap_agent_cli-0.1.1.tar.gz
  • Upload date:
  • Size: 26.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for imap_agent_cli-0.1.1.tar.gz
Algorithm Hash digest
SHA256 ea82d54fb098455b630bc1e9e172bff635453801eba8a72b10edfc5cba645fdc
MD5 9006ab5478331a29f5b0ebf2bdc0ea84
BLAKE2b-256 e8309a0a4a18ab78d617ffba8b5b1f8a0cc11199099f9ecde8a3d161a6983c9b

See more details on using hashes here.

Provenance

The following attestation bundles were made for imap_agent_cli-0.1.1.tar.gz:

Publisher: publish.yml on pseudosavant/imap-agent-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file imap_agent_cli-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: imap_agent_cli-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 19.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for imap_agent_cli-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d995d67687c4ef2154c2cc7d8245be15d603f7f6dfa90d38f8d0e62f103ca2e4
MD5 f9de84c2867042f235b4b7a5bea6d1d9
BLAKE2b-256 b15f083c3411eec41ba202ff9c1e63bebbc9624b9a45d3390a64cb77c2150bae

See more details on using hashes here.

Provenance

The following attestation bundles were made for imap_agent_cli-0.1.1-py3-none-any.whl:

Publisher: publish.yml on pseudosavant/imap-agent-cli

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page