Skip to main content
How-To Guides Last updated: 13 March 2026

How to Export Emails

Save emails and conversation threads to your local machine in Markdown, EML, MBOX, JSON, HTML, or CSV formats.

Save individual emails, batches, or entire conversation threads to disk in various formats for archiving, analysis, or migration.

Export a Single Email

“Export that email as markdown”

tool: export
params:
  target: "message"
  id: "AAMkAGR..."
  format: "markdown"
  savePath: "/tmp/email-export.md"

Export as EML (For Archiving)

EML is the standard email archive format, importable into any email client:

tool: export
params:
  target: "message"
  id: "AAMkAGR..."
  format: "eml"
  savePath: "/tmp/email.eml"

Export a Full Conversation Thread

“Export the entire thread about the contract review”

tool: export
params:
  target: "conversation"
  conversationId: "AAQkAGR..."
  format: "markdown"
  outputDir: "/tmp/contract-thread/"

Control message order:

tool: export
params:
  target: "conversation"
  conversationId: "AAQkAGR..."
  format: "mbox"
  outputDir: "/tmp/contract-thread/"
  order: "chronological"

Batch Export Multiple Emails

Export a list of specific emails:

tool: export
params:
  target: "messages"
  emailIds: ["AAMkAGR1...", "AAMkAGR2...", "AAMkAGR3..."]
  format: "markdown"
  outputDir: "/tmp/batch-export/"

Or export emails matching a search query:

tool: export
params:
  target: "messages"
  searchQuery:
    from: "finance@company.com"
    receivedAfter: "2026-01-01"
    maxResults: 50
  format: "json"
  outputDir: "/tmp/finance-export/"

Export as CSV (For Spreadsheets)

CSV exports email metadata (subject, from, to, dates) without body content — ideal for importing into Excel or Google Sheets:

tool: export
params:
  target: "messages"
  searchQuery:
    from: "finance@company.com"
    receivedAfter: "2026-01-01"
  format: "csv"
  outputDir: "/tmp/finance-audit/"

Batch CSV exports produce a single aggregated file with one row per email. CSV values are protected against formula injection (OWASP mitigation).

Get Raw MIME Content

For developers or forensic analysis:

tool: export
params:
  target: "mime"
  id: "AAMkAGR..."

Choose the Right Format

FormatBest forFile type
markdownReading, sharing, AI processing.md
emlArchiving, importing to other clients.eml
mboxBulk archiving (one file, many messages).mbox
jsonProgrammatic processing, data analysis.json
htmlViewing in a browser with formatting.html
csvSpreadsheet import, bulk metadata analysis.csv
mimeRaw email content, forensicsraw output

Parameter Reference

ParameterWhat it doesUsed with
targetmessage, messages, conversation, or mimeAll
idEmail IDmessage, mime
formatOutput format (see table above)message, messages, conversation
savePathFile path for single exportmessage
outputDirDirectory for batch/thread exportmessages, conversation
emailIdsArray of email IDsmessages
searchQuerySearch criteria for batch exportmessages
conversationIdThread IDconversation
orderchronological or reverseconversation
includeAttachmentsInclude attachmentsmessage (default: true)

Tips

  • Use markdown format for AI-readable exports
  • Use csv format to get email metadata into a spreadsheet for analysis
  • Use mbox for archiving entire conversations in a single file
  • Combine with search-emails to find emails first, then export the IDs
  • The searchQuery option in batch mode saves a step — no need to search first
Was this helpful?

Related Articles