main

View Workflow

View email content from search results or specific message paths.

Workflow Steps

1. Identify Target Email

Determine which email to view:

  • From search results: Use message path from mu find output
  • By message ID: Use mu find with msgid: query
  • By unique criteria: Search first, then view

2. Use mu view

View email content using mu:

# View by file path
mu view /path/to/email/file

# View from search with piping
mu find <query> --format=links | head -1 | xargs mu view

# View with specific format
mu view --format=plain /path/to/email
mu view --format=html /path/to/email

mu view Options:

  • --format=plain - Plain text output (default)
  • --format=html - HTML output
  • --summary - Show summary only
  • --terminate - Show only first part
  • No attachments inline - use Extract workflow for attachments

3. Extract Key Information

Parse and present:

  • Headers: From, To, Cc, Subject, Date
  • Body: Plain text or HTML content
  • Attachments: List of attached files (names and sizes)
  • Thread info: In-Reply-To, References for threading

4. Present to User

Format the email content clearly:

  • Show headers in structured format
  • Display body content appropriately (handle encodings)
  • List attachments separately
  • Highlight important information

5. Offer Follow-up Actions

Based on content, offer:

  • Extract attachments (→ Extract workflow)
  • View related emails in thread
  • Search for similar emails
  • Analyze sender patterns

Best Practices

Content Handling

  • Plain text preferred: More reliable parsing than HTML
  • Handle encodings: Emails may use quoted-printable, base64, etc.
  • MIME multipart: Many emails have both text and HTML parts
  • Large files: Some emails can be very large (2MB+) due to attachments

Privacy

  • Respect personal vs work boundaries
  • Redact sensitive info when summarizing
  • Be careful with email addresses and private data

Reading Raw Files

If mu view is unavailable or fails:

  • Use Read tool with offset/limit for large files
  • Parse headers manually (lines before first blank line)
  • Body starts after first blank line
  • Look for Content-Type headers for MIME structure

Examples

View most recent email from specific sender:

mu find from:alice@example.com --format=links | head -1 | xargs mu view

View specific email by message ID:

mu find msgid:abc123@example.com --format=links | xargs mu view

View email and extract headers:

mu view /home/vincent/desktop/mails/icloud/Inbox/cur/1234.msg --summary

View HTML email:

mu view --format=html /path/to/email

Understanding Email Structure

Headers (RFC 2822)

From: sender@example.com
To: recipient@example.com
Subject: Meeting Notes
Date: Mon, 15 Jan 2025 10:30:00 +0000
Message-ID: <unique-id@example.com>
In-Reply-To: <previous-msg-id@example.com>
Content-Type: multipart/alternative; boundary="boundary-string"

MIME Multipart Body

--boundary-string
Content-Type: text/plain; charset=utf-8

Plain text version of email

--boundary-string
Content-Type: text/html; charset=utf-8

<html>HTML version of email</html>

--boundary-string--

Common Encodings

  • quoted-printable: =C3=A9 for special characters
  • base64: Binary data encoded as text
  • UTF-8: Standard for international characters

Alternative: Direct File Reading

When mu is not available or for raw access:

# Read headers only (first ~50 lines usually enough)
head -50 /path/to/email/file

# Read full email (careful with large files)
cat /path/to/email/file

# Search within specific email
grep -i "keyword" /path/to/email/file

Using Claude Code tools:

Read tool with limit parameter for large files:
- First 50 lines for headers
- Offset to skip to body content

Error Handling

Common issues:

  • File too large: Use mu view instead of reading raw
  • Encoding issues: mu view handles encodings automatically
  • Attachments corrupted: Use Extract workflow with mu extract
  • HTML rendering: mu view –format=html or extract and open in browser

Typical flow:

  1. User requests to search (→ Search workflow)
  2. Results show multiple matches
  3. User asks to view specific email
  4. View workflow shows full content
  5. User may request to extract attachments (→ Extract workflow)