Skip to content

EmailOS Read Command Documentation

The mailos read command displays the full content of a specific email by its ID or from email files.

For Apple Mail URL handling and macOS-specific attachment export behavior, see macOS Mail Integration.

Basic Usage

bash
# Read from IMAP by email ID
mailos read [email_id]

# Read from email file
mailos read --file [email_file]

Displays the complete content of the specified email, including body text and attachment information. Supports reading from IMAP accounts or directly from email files in multiple formats (.eml, .mbox, .emlx, .msg).

Command-Line Flags

Basic Options

FlagShortTypeDefaultDescriptionExample
--accountstringEmail account to usemailos read --account value
--fromstringFilter emails by sender (e.g., --from [email protected])mailos read --from value
--limitint10Limit number of recent emails to readmailos read --limit value

Advanced Options

FlagShortTypeDefaultDescriptionExample
--copyboolfalseCopy email to clipboard after readingmailos read --copy
--attachment-timeoutint30Timeout in seconds for attachment export fallback via Mail.app (macOS)mailos read --attachment-timeout 15
--contentstringRead from raw text content instead of IMAP lookupmailos read --content "From: [email protected]\nSubject: Hi\n\nBody"
--content-filestringRead raw text content from a file pathmailos read --content-file /tmp/mail.txt
--content-fromstringOptional sender used when reading from content inputmailos read --content "Body" --content-from [email protected]
--content-htmlstringOptional HTML body to use for markdown/link extraction with content inputmailos read --content "Body" --content-html "<p>Body</p>"
--content-stdinboolfalseRead raw text content from stdin`pbpaste
--content-subjectstringOptional subject used when reading from content inputmailos read --content "Body" --content-subject "Clipboard Email"
--eml-filestringRead email from file (.eml, .mbox, .emlx, .msg)mailos read --eml-file value
--eml-outputstringDirectory to save EML file (default: current directory)mailos read --eml-output value
--export-emlboolfalseExport email to EML formatmailos read --export-eml
--filestringAlias for --eml-file (read from email file)mailos read --file value
--lastint0Show last N emails (alternative to --limit)mailos read --last value
--listboolfalseList recent emails with IDs for selectionmailos read --list
--links-onlyboolfalseOutput only extracted links for the target emailmailos read --links-only
--links-resolve-trackingboolfalseResolve tracking/redirect URLs to final destinations when possiblemailos read --links-resolve-tracking
--max-linksint0Maximum number of extracted links to output (0 = no limit)mailos read --max-links 10
--markdownbooltrueOutput email as plain markdown (default true)mailos read --markdown
--message-idstringMessage-ID to read (auto sync+retry on miss)mailos read --message-id value
--message-linkboolfalsePrint macOS message: URI for the resolved emailmailos read --message-link
--open-emlboolfalseExport email to EML format and open in default mail clientmailos read --open-eml
--open-message-linkboolfalseOpen macOS message: URI for the resolved emailmailos read --open-message-link
--recentboolfalseShow recent emails without requiring Message-IDmailos read --recent
--save-attachmentsstringDirectory to save attachments to disk (macOS can export via Mail.app by Message-ID)mailos read --save-attachments value
--show-attachmentsbooltrueDisplay attachment previews when availablemailos read --show-attachments
--suppress-attachment-errorsboolfalseDo not include attachment export errors in markdown outputmailos read --suppress-attachment-errors
--syncboolfalseFetch latest emails and retry Message-ID lookup when not found (for positional IDs)mailos read --sync
--temp-emlboolfalseCreate temporary EML file (deleted after 5 minutes)mailos read --temp-eml
--thread-idstringThread-ID to readmailos read --thread-id value
--uiduint320Email UID from search results (stable handoff for mailos read)mailos read --uid value
--write-mdstringWrite full email content to markdown file (specify filename or directory)mailos read --write-md value

Output Options

FlagShortTypeDefaultDescriptionExample
--include-documentsbooltrueParse and display attachment document content inlinemailos read --include-documents
--include-linksboolfalseInclude URLs and Links section in read outputmailos read --include-links
--jsonboolfalseOutput emails in JSON formatmailos read --json

--json with a specific email target now includes a standardized links array with per-link metadata (text, url, canonical_url, resolved_url, type, source).

Markdown output now linkifies detected URLs and bare domains (for example meet.google.com/...) into Markdown links, and appends a standardized Links: section.

Getting Email IDs

Before using the read command, you need to find the email ID using the search command:

bash
# Search for emails to get IDs
mailos search
mailos search --from [email protected]
mailos search --subject "meeting"

The search results will show email IDs that you can then use with the read command.

Reading from Email Files

The mailos read command can read emails directly from files without requiring an IMAP connection. This is useful for:

  • Viewing archived emails (.eml files)
  • Reading emails exported from other clients
  • Processing batch email files
  • Working offline with email data

Supported Formats

FormatExtensionDescriptionStatus
EML.emlStandard MIME email format✅ Full support
MBOX.mboxUnix mailbox format (extracts first message)✅ Supported
EMLX.emlxApple Mail format✅ Supported
MSG.msgOutlook message format⚠️ Limited (shows conversion instructions)

File Reading Examples

bash
# Read standard EML file
mailos read --file email.eml

# Read Unix mailbox file
mailos read --file archive.mbox

# Read Apple Mail file
mailos read --file message.emlx

# Read and export to markdown
mailos read --file email.eml --write-md output.md

# Read with attachment extraction
mailos read --file email.eml --save-attachments ./attachments/

# Read Outlook MSG file (shows conversion instructions)
mailos read --file outlook.msg

Format-Specific Notes

MBOX Files:

  • If the mbox file contains multiple messages, only the first message is displayed
  • Additional messages are ignored with a warning message

EMLX Files (Apple Mail):

  • XML metadata (plist) is automatically stripped from output
  • Byte-count header is properly handled

MSG Files (Outlook):

  • Currently not fully supported
  • Command shows helpful error with conversion tool suggestions (msgconvert, outlook-msg-reader)
  • Convert to .eml format first for best compatibility

Examples

Read a specific email by ID

bash
mailos read 1423

Read email using the --uid flag

bash
mailos read --uid 1423

Read raw content without IMAP

bash
mailos read --content-file /tmp/mail.txt --include-links
pbpaste | mailos read --content-stdin --content-subject "Clipboard Email"

Read by Message-ID URI directly

bash
mailos read "message://%3c79943605-7e8a-4e8a-970d-c2adec786dc1%40mtasv.net%3e"
bash
mailos read --message-id "<[email protected]>" --account [email protected] --markdown

Read email without parsing document attachments

bash
mailos read 1423 --include-documents=false

Read from EML file

bash
mailos read --file email.eml

Read from mbox file and export to markdown

bash
mailos read --file archive.mbox --write-md conversation.md

Read from Apple Mail file

bash
mailos read --file message.emlx

Read email file with attachment extraction

bash
mailos read --file email.eml --save-attachments ./attachments/

Output Format

The read command displays:

  • Email Headers: From, To, Subject, Date, Message-ID
  • Email Body: Full text content (HTML is converted to plain text)
  • Attachments: List of attachment filenames
  • Document Content: If --include-documents is enabled, displays parsed content from document attachments

Integration with Search and Files

IMAP Workflow

Typical workflow for reading from your email account:

bash
# 1. Search for emails to find IDs
mailos search --from [email protected]

# 2. Read specific email from search results
mailos read 1423

# 3. Use search filters to narrow down results
mailos search --subject "contract" --has-attachments
mailos read 1445

File-Based Workflow

Working with email files directly:

bash
# Read standalone email files
mailos read --file backup/important-email.eml

# Process multiple formats
mailos read --file exports/gmail-archive.mbox
mailos read --file apple-mail/message.emlx

# Export file content to markdown
mailos read --file email.eml --write-md analysis.md

Error Handling

Common errors and solutions:

bash
# Invalid email ID format
Error: Email ID 'abc' is not a valid number
# Solution: Use numeric email IDs only

# Missing email ID
Error: Please provide an email ID
# Solution: Run 'mailos search' first to get email IDs

# Email not found
Error: Email with ID 9999 not found
# Solution: Verify the email ID exists using 'mailos search'

Notes

  • Email IDs are obtained from the mailos search command
  • The command reads from your configured email account or from email files
  • Supports multiple email file formats: .eml, .mbox, .emlx, .msg (limited)
  • Document parsing supports common formats (PDF, DOC, etc.)
  • Large emails may take longer to load and display
  • Email content is displayed in plain text format
  • File reading works offline without IMAP connection
  • MBOX files: only first message is read from multi-message files

Troubleshooting

Email not found

  1. Verify the email ID is correct from search results
  2. Check if email has been deleted or moved
  3. Ensure you have access to the email account

Authentication errors

  1. Check your email configuration: mailos setup
  2. Verify your email password/app password is correct
  3. Ensure IMAP access is enabled for your email provider

Document parsing issues

  1. Use --include-documents=false to skip document parsing
  2. Check if the attachment format is supported
  3. Verify attachment isn't corrupted

See Also

Released under the MIT License.