Email JSON Reference
This is the complete reference for the email JSON format used in the outbox pattern.
Full schema
Section titled “Full schema”{ "subject": "Email subject line", "body": "Plain text email body", "status": "pending"}Field reference
Section titled “Field reference”to (required)
Section titled “to (required)”Array of recipient email addresses.
subject (required)
Section titled “subject (required)”Email subject line. String.
"subject": "Re: Your question about the project"body (required)
Section titled “body (required)”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"status (required)
Section titled “status (required)”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
cc (optional)
Section titled “cc (optional)”Array of CC recipients.
bcc (optional)
Section titled “bcc (optional)”Array of BCC recipients.
in_reply_to (optional)
Section titled “in_reply_to (optional)”Message-ID of the email being replied to. Enables threading.
references (optional)
Section titled “references (optional)”Space-separated list of Message-IDs in the thread chain.
Examples
Section titled “Examples”Simple email
Section titled “Simple email”{ "subject": "Quick update", "body": "Just wanted to let you know the task is complete.", "status": "pending"}Reply with threading
Section titled “Reply with threading”{ "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", "status": "pending"}Multiple recipients with CC
Section titled “Multiple recipients with CC”{ "subject": "Weekly report", "body": "Here's the weekly update...", "status": "pending"}File naming
Section titled “File naming”Any .json filename works. Recommended pattern:
{timestamp}-{description}.jsonExamples:
1703808000-reply.json1703808001-status-update.jsonresponse-to-john.json
Processing order
Section titled “Processing order”Files are processed in alphabetical order. Use timestamp prefixes for predictable ordering.
Error handling
Section titled “Error handling”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"}Limits
Section titled “Limits”- Recipients: Max 50 per email
- Subject: Max 998 characters
- Body: Max 10MB (plain text)
- Rate: ~100 emails/hour per agent