Skip to content

vrag99/mailagent

Repository files navigation

mailagent

Your inbox, on autopilot.

License PyPI version Python versions Docker image

Warning

🚧 Under active development — expect rough edges, breaking changes, and bugs. Contributions and issue reports welcome!

LLM-powered email agent that watches Maildir inboxes, classifies mail, and executes workflows. Docker sidecar for docker-mailserver.

Features

  • Multi-inbox support with 5 LLM providers (OpenAI, Anthropic, Gemini, OpenRouter, Groq)
  • LLM classification with keyword fallback
  • 4 action types: reply, ignore, notify, webhook — composable
  • Smart SMTP replies with threading, sent folder sync, and message flagging
  • Env var interpolation, JSON Schema autocomplete, global + per-inbox config
  • inotify watching, catch-up on restart, debounce, idempotent state
  • CLI (run, validate, test, schema) with rich output
  • Thread awareness, and reconstruction
  • Web dashboard for monitoring and config management
  • Calendar-aware scheduling actions
  • Plugin system for custom action types ... and more to come(based on feedback and bugs)

Quick start

Setting up a new mail server? Follow Path A in the setup guide.

Already running docker-mailserver? Follow Path B in the setup guide.

Here's a taste of what the stack looks like:

services:
  mailserver:
    image: ghcr.io/docker-mailserver/docker-mailserver:latest
    # ... your config

  mailagent:
    image: ghcr.io/vrag99/mailagent:latest
    env_file: ./mailagent.env
    volumes:
      - ./docker-data/dms/mail-data/:/var/mail/:ro
      - ./mailagent.yml:/app/config.yml:ro
      - ./mailagent-data/:/app/data/
    depends_on:
      mailserver:
        condition: service_healthy
    restart: unless-stopped
  1. Create mailagent.yml from the starter template
  2. Create mailagent.env with your API keys and secrets
  3. docker compose up -d

CLI

pip install docker-mailagent
Usage: mailagent <command> [options]

Commands:
  run         Start the mail agent daemon (default)
  validate    Validate the config file and exit
  test        Dry-run a .eml file through the pipeline
  schema      Print the JSON Schema to stdout

Options:
  -c, --config PATH    Config file path (default: /app/config.yml)
  -v, --verbose        Enable debug logging
mailagent validate -c ./mailagent.yml
mailagent test ./some-email.eml -c ./mailagent.yml
mailagent schema > schema.json

Schema autocomplete

Add to the top of your YAML file:

# yaml-language-server: $schema=https://raw.githubusercontent.com/vrag99/mailagent/main/schema.json

VS Code mapping:

{
  "yaml.schemas": {
    "https://raw.githubusercontent.com/vrag99/mailagent/main/schema.json": "mailagent.yml"
  }
}

Configuration

mailagent is configured via a single mailagent.yml file with four top-level sections: providers, defaults, inboxes, and settings. Workflows are inbox-local and evaluated in order (first match wins).

See the full configuration reference and examples.

Development

pip install -e .
pytest -q
docker build -t mailagent/mailagent:local .

License

MIT

About

Self hostable, agentic email inbox. Built on top of docker mailserver. WIP

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors