Skip to content
Registry

email

v0.1.1

Email worker — SMTP send and real-time IMAP read with IDLE push (email::*).

emailimapinboxmessagingsmtp

Install

bash
iii trigger compose::add worker=email@0.1.1

Run in your project with the iii engine running. Exact versions are immutable and digest-pinned.

Functions8

email::accounts::list

Function

List configured email accounts. Returns { accounts: [{ name, provider, from, can_send, can_read, folders }] }. Use `name` as the `account` field for email::send, email::list, email::get, email::search, email::flag, email::move, and email::attachment::get.

Request
valueunknown
Response
valueunknown

email::attachment::get

Function

Stream an attachment's raw bytes from a message. Payload: { account, folder, uid, part_id }. `part_id` comes from email::get's attachments[].part_id. Bytes flow over the response channel in chunks as IMAP delivers them; no in-memory buffering. Channel closes on EOF.

Request
valueunknown
Response
valueunknown

email::flag

Function

Add or remove a system flag on a message. Payload: { account, folder, uid, flag, add?=true }. `flag` is one of 'seen', 'flagged', 'answered', 'deleted', 'draft' (without the leading backslash). Marking a message 'deleted' does NOT expunge — use email::move to trash, or future email::expunge.

Request
valueunknown
Response
valueunknown

email::get

Function

Fetch a single message by UID. Payload: { account, folder, uid }. Returns { uid, message_id, from, to[], subject, date, html?, text?, attachments: [{ part_id, filename, content_type, size }] }. Use email::attachment::get with the returned part_id to stream attachment bytes.

Request
valueunknown
Response
valueunknown

email::list

Function

List recent messages in a folder. Payload: { account, folder?='INBOX', limit?=50, since_uid?=<int> }. Returns { items: [{ uid, message_id, from, subject, snippet, ts, seen, flagged }], next_since_uid }. Pass next_since_uid back as since_uid to page forward without missing or duplicating messages.

Request
valueunknown
Response
valueunknown

email::move

Function

Move a message to another folder. Payload: { account, folder, uid, dst_folder }. Uses RFC 6851 UID MOVE when the server supports it; falls back to COPY + STORE \Deleted otherwise. Destination folder must exist on the server.

Request
valueunknown
Response
valueunknown

email::search

Function

Stream search results from an account's IMAP. Payload: { account, folder?='INBOX', query }. `query` is IMAP SEARCH syntax (RFC 9051), e.g. 'FROM alice@x SINCE 1-Jan-2026' or 'UNSEEN SUBJECT "invoice"'. Returns NDJSON frames on the response channel; each frame is { uid, message_id, from, subject, snippet, ts, seen, flagged }. Channel closes when search completes. No polling — frames stream as IMAP returns matches.

Request
valueunknown
Response
valueunknown

email::send

Function

Send an email via the account's SMTP transport. Payload: { account: string (key from email worker config), to: string[], cc?: string[], bcc?: string[], subject: string, html?: string, text?: string, reply_to?: string, in_reply_to?: string (Message-ID), references?: string[], attachments?: [{ filename, content_type, source: { kind: 'base64', data } }] }. Returns { message_id }. Credentials are fetched from auth-credentials under provider key `email::<account>` ({ username, password }). Provide html OR text (or both); at least one body is required.

Request
valueunknown
Response
valueunknown

Triggers1

email::new-mail

Trigger

Fires when IMAP IDLE pushes a new message to a configured (account, folder). Payload: { account, folder, uid, message_id, from, subject, snippet, ts }. If the IMAP server lacks the IDLE capability, the account fails at startup (E610).

Invocation
valueunknown
Return
valueunknown

Search the registry

Find workers, kits and executables, or jump to a page.