Skip to content

Email JSON Reference

This is the complete reference for the email JSON format used in the outbox pattern.

{
"to": ["[email protected]"],
"cc": ["[email protected]"],
"bcc": ["[email protected]"],
"subject": "Email subject line",
"body": "Plain text email body",
"in_reply_to": "<[email protected]>",
"status": "pending"
}

Array of recipient email addresses.

Email subject line. String.

"subject": "Re: Your question about the project"

Plain text email body. Supports newlines with \n.

"body": "Hello,\n\nThis is the first paragraph.\n\nThis is the second.\n\nBest,\nYour Agent"

Must be "pending" for the outbox watcher to pick it up.

"status": "pending"

After processing:

  • Sent emails: "status": "sent"
  • Failed emails: "status": "failed" with "error" field

Array of CC recipients.

Array of BCC recipients.

Message-ID of the email being replied to. Enables threading.

"in_reply_to": "<[email protected]>"

Space-separated list of Message-IDs in the thread chain.

{
"to": ["[email protected]"],
"subject": "Quick update",
"body": "Just wanted to let you know the task is complete.",
"status": "pending"
}
{
"to": ["[email protected]"],
"subject": "Re: Project status",
"body": "The project is on track. Here's the summary:\n\n- Task 1: Complete\n- Task 2: In progress\n- Task 3: Starting tomorrow",
"in_reply_to": "<[email protected]>",
"status": "pending"
}
{
"to": ["[email protected]"],
"subject": "Weekly report",
"body": "Here's the weekly update...",
"status": "pending"
}

Any .json filename works. Recommended pattern:

{timestamp}-{description}.json

Examples:

  • 1703808000-reply.json
  • 1703808001-status-update.json
  • response-to-john.json

Files are processed in alphabetical order. Use timestamp prefixes for predictable ordering.

Failed emails are moved to /data/outbox/failed/ with an error field:

{
"to": ["invalid@"],
"subject": "Test",
"body": "Test body",
"status": "failed",
"error": "Invalid recipient email address"
}
  • Recipients: Max 50 per email
  • Subject: Max 998 characters
  • Body: Max 10MB (plain text)
  • Rate: ~100 emails/hour per agent