Skip to main content
Send, draft, read, search, count emails, and download attachments. Enable by including "email_*" in the agent’s allowedTools array.
SMTP (send): Uses nodemailer. Credentials from agent vault ("email" entry with type "smtp"), env vars (SMTP_HOST, SMTP_PORT, SMTP_USER, SMTP_PASS, SMTP_FROM), or per-call parameter overrides.IMAP (read/search): Uses imapflow. Credentials from agent vault ("email-inbox" entry with type "imap") or env vars (IMAP_HOST, IMAP_PORT, IMAP_USER, IMAP_PASS).
The easiest way to configure email credentials is through the onboarding wizard: polpo agent onboard <name>. Step 4 walks you through SMTP and IMAP setup, creates vault entries with ${ENV_VAR} references, and adds email_* to allowedTools automatically. See Onboarding walkthrough.

email_draft — Save Draft Email

Create an email draft and save it to the IMAP Drafts folder.

Parameters

ParameterTypeRequiredDescription
tostring | string[]noRecipient email address(es)
subjectstringnoEmail subject line
bodystringnoDraft body content
htmlbooleannoSave body as HTML draft (auto-detected if omitted)
ccstring | string[]noCC recipient(s)
bccstring | string[]noBCC recipient(s)
fromstringnoSender address (defaults to SMTP_FROM or IMAP user)
reply_tostringnoReply-to address
attachmentsarray of {path, filename?}noFile attachments
folderstringnoDrafts folder path (default: auto-detect, then "Drafts")
imap_hoststringnoIMAP host (overrides vault/env)
imap_portnumbernoIMAP port (overrides vault/env)
imap_userstringnoIMAP username (overrides vault/env)
imap_passstringnoIMAP password (overrides vault/env)
imap_tlsbooleannoIMAP TLS setting (overrides vault/env)

Returns

Confirmation with the target folder and append metadata.

Notes

  • Drafts are saved via IMAP APPEND with the \\Draft flag
  • If folder is omitted, Polpo auto-detects the mailbox with special-use \\Drafts, then falls back to Drafts
  • Attachment paths are sandboxed exactly like email_send

email_send — Send Email

Send an email via SMTP.

Parameters

ParameterTypeRequiredDescription
tostring | string[]yesRecipient email address(es)
subjectstringyesEmail subject line
bodystringyesEmail body content
htmlbooleannoSend as HTML email (auto-detected if omitted)
ccstring | string[]noCC recipient(s)
bccstring | string[]noBCC recipient(s)
fromstringnoSender address (overrides vault/env)
reply_tostringnoReply-to address
attachmentsarray of {path, filename?}noFile attachments
smtp_hoststringnoSMTP host (overrides vault/env)
smtp_portnumbernoSMTP port (overrides vault/env)
smtp_userstringnoSMTP username (overrides vault/env)
smtp_passstringnoSMTP password (overrides vault/env)
smtp_securebooleannoUse TLS (overrides auto-detection)

Returns

Confirmation with the message ID and accepted recipients.

Notes

  • Credential resolution order: tool parameters > agent vault > environment variables
  • Port 465 uses implicit TLS; all other ports use STARTTLS
  • When html is omitted, the body is auto-detected — if it contains HTML tags, it’s sent as HTML

email_verify — Verify SMTP Connection

Test that the SMTP connection and credentials are valid without sending an email.

Parameters

ParameterTypeRequiredDescription
smtp_hoststringnoSMTP host (overrides vault/env)
smtp_portnumbernoSMTP port (overrides vault/env)
smtp_userstringnoSMTP username (overrides vault/env)
smtp_passstringnoSMTP password (overrides vault/env)

Returns

Success or failure message indicating whether the SMTP connection was established and authenticated.

email_list — List Emails

List recent emails from an IMAP mailbox.

Parameters

ParameterTypeRequiredDescription
folderstringnoMailbox folder (default: "INBOX")
limitnumbernoMax emails to return (default: 20)
unseen_onlybooleannoOnly return unread emails (default: false)

Returns

List of emails with UID, subject, from address, date, and read/unread status.

email_read — Read Email

Read a single email by its UID. Returns the full email content plus attachment metadata (filename, size, MIME type, part ID) for any attachments present.

Parameters

ParameterTypeRequiredDescription
uidnumberyesEmail UID (from email_list)
folderstringnoMailbox folder (default: "INBOX")
mark_readbooleannoMark as read after fetching (default: true)
download_attachmentsbooleannoDownload all attachments to the task output directory (default: false). Use email_download_attachment for selective download.

Returns

Full email content: subject, from, to, date, text/HTML body, and an attachments section listing each attachment with:
  • Part number — the MIME part ID needed for email_download_attachment
  • Filename — original filename from the email
  • MIME type — e.g. application/pdf, image/png
  • Size — approximate size in KB
If download_attachments is true, also includes the list of file paths where attachments were saved.

Notes

  • Attachment metadata is extracted from the IMAP bodyStructure response — no additional download is needed just to see what’s attached
  • Use email_download_attachment to selectively download individual attachments by part number

email_download_attachment — Download Email Attachment

Download a specific attachment from an email by UID and MIME part number. Use email_read first to see the list of attachments with their part numbers.

Parameters

ParameterTypeRequiredDescription
uidnumberyesEmail UID (from email_list or email_read)
partstringyesMIME part number of the attachment (from email_read attachment list, e.g. "2", "1.2")
folderstringnoMailbox folder (default: "INBOX")
filenamestringnoOverride the output filename (default: uses the attachment’s original filename)
output_pathstringnoCustom output path relative to working directory (default: task output directory)

Returns

Confirmation with the saved file path, size, content type, and part number.

Notes

  • The output file is sandboxed to the agent’s allowed paths
  • If no output_path is specified, the file is saved to the task’s output directory
  • Typical workflow: email_listemail_read (see attachments) → email_download_attachment (download specific ones)

email_search — Search Emails

Search emails by criteria.

Parameters

ParameterTypeRequiredDescription
fromstringnoSearch by sender address
tostringnoSearch by recipient address
subjectstringnoSearch by subject (substring)
sincestringnoSearch emails since date (YYYY-MM-DD)
beforestringnoSearch emails before date (YYYY-MM-DD)
bodystringnoSearch by body text (substring)
answeredbooleannoFilter by answered flag (true = answered, false = unanswered)
folderstringnoMailbox folder (default: "INBOX")
limitnumbernoMax results (default: 20)

Returns

List of matching emails with UID, subject, from, and date.

Notes

  • At least one search criterion is required
  • Multiple criteria are AND-ed together (e.g. from + since returns emails from that sender after that date)
  • Use since + before together for date range queries

email_count — Count Emails

Count emails matching filters without downloading message contents. Uses IMAP SEARCH internally and returns the result count.

Parameters

ParameterTypeRequiredDescription
fromstringnoCount emails from sender
tostringnoCount emails to recipient
subjectstringnoCount emails matching subject (substring)
sincestringnoCount emails since date (YYYY-MM-DD)
beforestringnoCount emails before date (YYYY-MM-DD)
bodystringnoCount emails matching body text (substring)
answeredbooleannoFilter by answered flag (true = answered, false = unanswered)
unseen_onlybooleannoCount only unread emails (default: false)
folderstringnoMailbox folder (default: "INBOX")

Returns

Total count and unread count of emails matching the filters.

Notes

  • With no filters, counts all emails in the folder
  • No message content is downloaded — uses IMAP SEARCH for efficient counting
  • Useful for aggregations: “how many emails from X this month?”, “how many unread?”