Minimal Agent Zero plugin for reading, searching, and sending email through preconfigured IMAP/SMTP accounts without exposing
credentials to the AI.
- Python 76.3%
- HTML 13.1%
- JavaScript 8.6%
- Shell 2%
| Filename | Latest commit message | Latest commit date |
|---|---|---|
Drop the provider-name example from the preset line to keep agent guidance free of provider-identifying details. Functional preset data in `helpers/provider_presets.py` is unchanged. |
||
| api | ||
| helpers | ||
| prompts | ||
| tests | ||
| tools | ||
| webui | ||
| .gitignore | ||
| __init__.py | ||
| AGENTS.md | ||
| CHANGELOG.md | ||
| default_config.yaml | ||
| deploy.sh | ||
| execute.py | ||
| LICENSE | ||
| plugin.yaml | ||
| README.md | ||
| thumbnail.jpg | ||
AI Mail Plugin
Agent Zero plugin for reading, searching, sending, and trashing email through preconfigured IMAP/SMTP accounts without exposing credentials to the AI.
Quick Start
./deploy.sh deploy
Requires Agent Zero process restart for Python code changes. Config changes
(plugin settings, config.json) take effect without restart.
Key Directories
| Directory | Purpose |
|---|---|
tools/ |
Agent Zero native tool (IMAP/SMTP client) |
helpers/ |
Core logic: IMAP/SMTP clients, models, config, security |
tests/ |
Unit and integration tests |
prompts/ |
Tool prompt documentation for agent system |
webui/ |
Settings screen, account editor modal, config store |
api/ |
API endpoint tests |
Key Files
plugin.yaml- Plugin manifest (name, version, dependencies)execute.py- Plugin entry pointtools/ai_mail.py- Agent Zero tool (list, search, send, trash)helpers/mail_service.py- Mail service orchestrationhelpers/imap_client.py- IMAP client wrapper with injectable transportshelpers/smtp_client.py- SMTP client wrapper with injectable transportshelpers/content_security.py- Prompt injection protection for email contenthelpers/config.py- Plugin config and account normalizationhelpers/models.py- Account and message data modelsdefault_config.yaml- Default configuration templatedeploy.sh- Build, deploy, validate, and zip script
Tech Stack
Python 3.12+ | IMAP | SMTP | Flask | Alpine.js
Notes
- Accounts are configured in plugin settings, not by the AI; the AI only sees account summaries, account IDs, rights, and account context.
- Per-account permissions are independent:
can_read,can_send,can_delete. An account may be read-only, send-only, or allow trashing without sending. - Message selection uses
folder + uid;Message-IDis not part of the AI-facing API. - Outgoing recipient whitelist is global, exact addresses only,
case-insensitive. Applies to
to,cc, andbcc. - Trash handling supports
manualmode (configuredtrash_folder) andautomode (IMAP special-use discovery, legacyXLIST, mailbox name heuristics). Detected folder is persisted as a cache. - Search targets exactly one folder per request.
search_insupportssubject,body,from,towith OR logic for multiple areas. - Content security: email content framing, injection pattern neutralization, control character stripping, body length limiting.
- No attachment download or sending in the current implementation.
- Hard-delete is not exposed to the AI; only move-to-trash is supported.
- SPDX-License-Identifier: MIT