mail:read

Fetches one message and returns its parsed headers and bodies, through whichever connection answers the mail:read capability.

Options

NameTypeDescription
connectionstringThe connection id to read mail with; empty resolves the only connection answering mail:read
mailboxstringThe mailbox the message lives in (default INBOX)
uidstringThe message uid to read, as returned by mail:list

Outputs

NameTypeDescription
uidstringThe message uid
fromstringThe sender header
tostringThe recipients header
ccstringThe carbon-copy header
subjectstringThe decoded subject header
datestringThe date header
message_idstringThe message-id header
textstringThe text/plain body
htmlstringThe text/html body

Examples

name: Read the newest unread message
actions:
  - name: inbox
    component: mail:list
    vars:
      search: UNSEEN
      limit: 1

  - name: message
    component: mail:read
    vars:
      uid: "{{ inbox.messages | first | key:'uid' }}"

outputs:
  subject: "{{ message.subject }}"
  body: "{{ message.text }}"

Summarize

Feeds a fetched message into a model. mail:read returns the parsed text body, so the inference step consumes it like any other pipeline value with no scraping or format juggling in between.

name: Summarize an invoice email
actions:
  - name: inbox
    component: mail:list
    vars:
      search: FROM "billing@" SUBJECT "invoice"
      limit: 1

  - name: invoice
    component: mail:read
    vars:
      uid: "{{ inbox.messages | first | key:'uid' }}"

  - name: summary
    component: llm:generate
    vars:
      provider: openai
      model: gpt-5
      prompt: |
        Summarize this invoice email in one sentence, including the amount due:

        {{ invoice.text }}

outputs:
  summary: "{{ summary.content }}"