2.5 KiB
2.5 KiB
name, description
| name | description |
|---|---|
| internal-mail-agent | Use when Codex or another agent needs to work with an internal/local mailbox through the internal-mail-skill REST adapter: syncing POP3 mail, searching and reading email, managing local read/processed/archived/replied state, labels, drafts, replies, forwards, or sending through SMTP when Gmail/IMAP tools are unavailable and the local adapter is running or can be started. |
Internal Mail Agent
Use the local REST adapter as the mailbox backend. The adapter usually runs at http://127.0.0.1:8765 and stores POP3 mail, local state, labels, drafts, and sent records in SQLite.
Before Use
- Resolve the base URL from the user,
INTERNAL_MAIL_SKILL_BASE_URL, or default tohttp://127.0.0.1:8765. - Call
GET /health. If it fails, ask the user to start the adapter or start it from the repo withgo run ./cmd/serverwhen local context allows. - Treat POP3 server state as one-way input. Read, processed, archived, deleted, replied, labels, drafts, and sent records are local adapter state only.
- Never expose attachment storage paths. Use only
attachment_id, filename, content type, and size returned by the API.
Common Workflow
- For fresh mailbox work, call
POST /syncfirst unless the user explicitly wants local-only results. - For triage, use
GET /emails/searchwith filters, then read only the messages needed withGET /emails/{id}. - For threads, call
GET /emails/{id}/thread; the adapter assembles local threads fromMessage-ID,In-Reply-To, andReferences. - For organization, use
POST /emails/{id}/mark,POST /labels, andPOST /emails/labels/apply. - For composing, prefer
POST /draftsand show the draft summary before sending unless the user explicitly requested immediate send. - For explicit sends, use
POST /drafts/{id}/sendorPOST /send. The adapter writes every attempt tosent_messages.
Sending Rules
- Do not send email unless the user has clearly asked to send, reply, or forward.
- Include
to,cc, andbccarrays in requests as needed. Bcc participates in SMTP delivery but must not appear in message headers. - For replies, pass
reply_to_email_idwhen creating the draft so the adapter can setIn-Reply-ToandReferencesand mark the source email replied after successful send. - If send fails, surface the structured error and do not claim the message was sent.
- SMTP delivery does not guarantee the message appears in Webmail "Sent".
API Reference
For request shapes, query parameters, response notes, and curl examples, read references/http-api.md.