Module: Mailmate::CLI::Send Private

Extended by:
Send
Included in:
Send
Defined in:
lib/mailmate/cli/send.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

mm-send — send mail through MailMate's emate CLI with a markdown body. Replaces the 6-line bash wrapper that previously lived at ~/.claude/skills/email/send-email. All flags pass through to emate mailto; --markup markdown is enforced.

Constant Summary collapse

EMATE_PATH =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

"/Applications/MailMate.app/Contents/Resources/emate"
PREAMBLE =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

<<~PREAMBLE
  mm-send — thin wrapper around `emate mailto` with `--markup markdown` enforced.
  Body is read from stdin. All other flags pass through to emate (its help follows).

  Replies and threading
    MailMate auto-generates the outgoing Message-ID — never your job.
    In-Reply-To and References are PURE PASS-THROUGH: whatever you set via
    `--header` ships verbatim; what you don't set is absent (and recipients'
    clients will see the message as a fresh thread, no matter how `Re:` the
    subject looks). To make a reply land in-thread, pass both:

      mm-send -f you@x -t them@y -s "Re: foo" \\
        --header "In-Reply-To: <parent-message-id@domain>" \\
        --header "References: <root-mid> <parent-mid>" \\
        --send-now <<<"body"

    References is constructed as the source message's References header (if
    any) with the source's Message-ID appended. If the source is a thread
    root with no References, just use its Message-ID alone.

  Identity selection
    `-f <address>` picks which of MailMate's configured identities sends.
    Without `-f`, MailMate uses its default identity. See `mmdiscover` to
    list available addresses.

  ──────────────────────────── emate help follows ────────────────────────────

PREAMBLE

Instance Method Summary collapse

Instance Method Details

#run(argv) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns the exit status of the spawned emate invocation. Uses system (not exec) so the caller — and the test suite — can actually observe the result.



47
48
49
50
51
52
53
54
55
56
# File 'lib/mailmate/cli/send.rb', line 47

def run(argv)
  Mailmate::PlatformError.check_darwin!(component: "mm-send")
  unless File.executable?(EMATE_PATH)
    warn "mm-send: emate not found at #{EMATE_PATH}. Is MailMate installed?"
    return 1
  end
  warn PREAMBLE if argv.include?("--help") || argv.include?("-h")
  system(EMATE_PATH, "mailto", "--markup", "markdown", *argv)
  $?.exitstatus
end