Skip to content

Reply Command

Reply to emails while preserving thread context and conversation history.

Usage

bash
# Method 1: Using email ID from search results
mailos reply [email_id] [flags]

# Method 2: Using email title and sender (exact matching)
mailos reply --email-title "Subject" --from "[email protected]" [flags]

Description

The reply command allows you to respond to specific emails while maintaining proper email threading. Unlike the send command which creates new emails, reply ensures your response becomes part of the existing conversation thread.

Email Identification Methods

The email_id parameter uses the actual IMAP message ID shown in search results:

bash
# First, search for emails to see available IDs
mailos search --from [email protected]
# Output shows: ID: 20691, ID: 18432, etc.

# Reply using the specific email ID
mailos reply 20691 --body "Thanks for the update!"
mailos reply 18432 --body "I'll be there at 10am"

Method 2: Using Email Title and Sender (New!)

For exact matching by subject and sender email address:

bash
# Reply to specific email by exact title and sender
mailos reply --email-title "Project Update" --from "[email protected]" --body "Received!"

# Create draft reply using title/sender matching
mailos reply --email-title "Meeting Request" --from "[email protected]" --draft --body "I'll attend"

Important:

  • Email title matching is exact (case-insensitive)
  • Sender matching uses just the email address, not the display name
  • Both --email-title and --from flags must be provided together

Threading Behavior

The reply command automatically:

  • Preserves conversation threads by setting proper email headers (In-Reply-To, References)
  • Maintains subject line with "Re:" prefix if not already present
  • Sets correct recipients (reply to sender, or reply-all to all recipients)
  • Includes original message context in interactive mode

Flags

Basic Options

  • --body string - Reply body text
  • --subject string - Override reply subject (keeps "Re:" prefix)
  • -f, --file string - Read body content from file
  • -i, --interactive - Force interactive composition mode

Email Selection (New!)

  • --email-title string - Find email by exact subject/title (use with --from)
  • --from string - Find email from specific sender (use with --email-title)

Recipient Options

  • --all - Reply to all recipients (reply-all)
  • --to strings - Override recipients
  • --cc strings - Add CC recipients
  • --bcc strings - Add BCC recipients

Draft Options

  • --draft - Save as draft instead of sending immediately

Examples

Basic Reply (Using Email ID)

bash
# Interactive reply using email ID from search
mailos reply 20691

# Quick reply with message
mailos reply 18432 --body "Thanks for your email!"

# Reply with custom subject
mailos reply 15234 --subject "Re: Updated timeline" --body "Looks good"

Basic Reply (Using Title/Sender - New!)

bash
# Reply using exact title and sender matching
mailos reply --email-title "Hello" --from "[email protected]" --body "4x5 = 20"

# Reply to meeting invite
mailos reply --email-title "Team Meeting" --from "[email protected]" --body "I'll be there"

# Reply with custom subject override
mailos reply --email-title "Project Update" --from "[email protected]" --subject "Re: Revised timeline" --body "Approved"

Reply All

bash
# Reply to all recipients using email ID
mailos reply 20691 --all --body "Thanks everyone for the feedback"

# Reply all using title/sender with additional CC
mailos reply --email-title "Team Update" --from "[email protected]" --all --cc [email protected] --body "Looping in the team"

File-based Reply

bash
# Read reply content from file using email ID
mailos reply 18432 --file response.txt

# Using title/sender with file content
mailos reply --email-title "Support Request" --from "[email protected]" --file template.txt --cc [email protected]

Draft Mode

bash
# Save reply as draft using email ID
mailos reply 20691 --body "Draft response" --draft

# Create draft using title/sender matching
mailos reply --email-title "Invoice" --from "[email protected]" --body "Payment processed" --draft

# Create draft reply-all
mailos reply 15234 --all --body "Team update" --draft

Advanced Examples

bash
# Override all recipients using email ID
mailos reply 20691 --to [email protected] --body "Forwarding to you"

# Reply with BCC using title/sender matching
mailos reply --email-title "Bug Report" --from "[email protected]" --body "Will handle this" --bcc [email protected]

# Interactive reply all with custom subject
mailos reply --email-title "Proposal" --from "[email protected]" --all --subject "Re: Revised proposal" --interactive

Interactive Mode

When no --body or --file is specified, or when --interactive is used, the reply command enters interactive mode:

  1. Shows original email context
  2. Opens composition interface
  3. Automatically includes quoted original message
  4. Press Enter twice to finish composition
bash
mailos reply 1 --interactive

Output:

📧 Replying to: Project Update
   From: [email protected]
   Date: Oct 18, 2025 at 2:30 PM
   Message-ID: <[email protected]>

────────────────────────────────────────────
📝 Compose your reply:
   (Press Enter twice to finish)
────────────────────────────────────────────
Thanks for the update!

[Your message here]


✓ Reply sent successfully!

Threading Details

Message Headers

The reply command automatically sets these headers for proper threading:

  • In-Reply-To: <[email protected]>
  • References: Chain of Message-IDs in the conversation
  • Subject: "Re: Original Subject" (if not already prefixed)

Conversation Chains

For multi-reply conversations:

Original Email: <[email protected]>
├── Reply 1: References: <[email protected]>
├── Reply 2: References: <[email protected]> <[email protected]>  
└── Reply 3: References: <[email protected]> <[email protected]> <[email protected]>

Error Handling

Common errors and solutions:

bash
# Email ID not found
Error: email 'with UID 99999' not found
# Solution: Use correct email ID from search results

# Email title/sender not found (using new method)
No emails found with exact title 'Wrong Title' from '[email protected]'
# Solution: Check exact spelling and sender address

# Missing required flags for title/sender method
Error: email identifier required
# Solution: Use either email_id OR both --email-title and --from flags

# Invalid email ID
Error: invalid email number: abc
# Solution: Use numeric email ID from search results

Integration with Other Commands

Typical Workflow (Method 1: Email ID)

bash
# 1. Search for emails to see available IDs
mailos search --from [email protected]
# Output: ID: 20691, ID: 18432, etc.

# 2. Read specific email for context using the ID
mailos read 20691

# 3. Reply to the email using the same ID
mailos reply 20691 --body "Thanks for reaching out!"

# 4. Check drafts or sent emails
mailos search --type sent

Alternative Workflow (Method 2: Title/Sender)

bash
# 1. If you know the exact email title and sender
mailos reply --email-title "Hello" --from "[email protected]" --body "Hi there!"

# 2. For emails you can't find by ID
mailos reply --email-title "Meeting Confirmation" --from "[email protected]" --draft --body "Confirmed"

Draft Workflow

bash
# Create reply draft
mailos reply 2 --body "Initial response" --draft

# Edit the draft later
mailos draft edit 1 --body "Updated response"

# Send the draft
mailos send --drafts

Tips

  1. Use Email IDs: Use mailos search to get email IDs, then use those IDs with mailos reply
  2. Title/Sender Method: Use --email-title and --from when you know exact subject and sender
  3. Exact Matching: Email title matching is case-insensitive but must be exact
  4. Use Read: Use mailos read [email_id] to view full email content before replying
  5. Draft for Review: Use --draft for important replies that need review
  6. Reply-All Carefully: Double-check recipients when using --all flag
  7. File Templates: Create reusable response templates with --file option

See Also

Released under the MIT License.