/mail-cloak:mail-cloakfrom mail-cloak
Sends plain-text email over SMTP through a local SOCKS5 proxy (wireproxy or Tor) so the sender's IP never reaches Received: headers, with a human approving every send; also reads mail read-only over IMAP through the same proxy. Use when the user says "send this email via SMTP", "send without exposing my IP", "hide my IP in email headers", "check my email headers for an IP leak", "check my inbox via IMAP", "read replies without exposing my IP", or "did bob reply". Not for provider-API connectors, POP3 or bulk mail.
Ships in mail-cloak. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
The plugin does four things a hand-run msmtp or himalaya does not:
\Seen.It never stores or reads a secret: msmtp's own passwordeval does.
Each line below is a literal command. The guard's verdict for it is in the comment, and
tests/guard-cases.sh reads these lines out of this file to prove it.
bash "${CLAUDE_PLUGIN_ROOT}/scripts/doctor.sh" # allow: preflight; exit 0 = send-ready
bash "${CLAUDE_PLUGIN_ROOT}/scripts/doctor.sh" --read # allow: exit 0 = read-ready (msmtp not needed)
bash "${CLAUDE_PLUGIN_ROOT}/scripts/egress-check.sh" # allow: one JSON line {direct_v4, direct_v6, proxied, ok}
bash "${CLAUDE_PLUGIN_ROOT}/scripts/new-eml.sh" --to [email protected] --subject "Hello" --body-file body.txt # allow: prints the outbox path
bash "${CLAUDE_PLUGIN_ROOT}/scripts/new-eml.sh" --to [email protected] --subject "Re: Hello" --body-file body.txt --in-reply-to "<[email protected]>" # allow: a threaded reply
bash "${CLAUDE_PLUGIN_ROOT}/scripts/send.sh" --dry-run msg.eml # allow: every step but msmtp
bash "${CLAUDE_PLUGIN_ROOT}/scripts/send.sh" msg.eml # ASKS: the real send
bash "${CLAUDE_PLUGIN_ROOT}/scripts/header-check.sh" # ASKS: sends a probe to PROBE_RECIPIENT
bash "${CLAUDE_PLUGIN_ROOT}/scripts/header-check.sh" --headers h.txt --direct-v4 198.51.100.7 --direct-v6 2001:db8:1::1 # allow: asserts saved headers only
bash "${CLAUDE_PLUGIN_ROOT}/scripts/inbox.sh" list -n 10 # allow: newest 10, id/date/from/subject
bash "${CLAUDE_PLUGIN_ROOT}/scripts/inbox.sh" search --from [email protected] --since 2026-11-01 # allow: read-only search
bash "${CLAUDE_PLUGIN_ROOT}/scripts/inbox.sh" read 12 # allow: never marks it \Seen
bash "${CLAUDE_PLUGIN_ROOT}/scripts/inbox.sh" read 12 --folder "[Gmail]/Spam" # allow: ids are per folder
bash "${CLAUDE_PLUGIN_ROOT}/scripts/inbox.sh" folders # allow: mailbox names
State lives in ${XDG_STATE_HOME:-~/.local/state}/mail-cloak/:
outbox/ holds the .eml files new-eml.sh writes.sent.jsonl gets one line per send: ts, message_id, to/cc/bcc arrays, subject, sha256,
proxied_ip, smtpstatus. No body.probe-<key>.pass records a header-check PASS for this account + SOCKS endpoint.A PreToolUse guard returns permissionDecision: "ask" before:
send.sh without --dry-run, under any path or variable;header-check.sh except --headers <file> or --dry-run;msmtp run directly, sendmail, swaks, mail/mailx/mutt
with a recipient, curl smtp(s)://, python smtplib.SMTP(, and openssl s_client /
nc / socat / telnet to :25, :465 or :587. It sees through sudo, timeout, env,
bash -c, eval and pipes into a shell.The prompt lists every To, Cc and Bcc recipient, the Subject and sha256[:12] of the
.eml. It carries no egress verdict: egress-check runs after approval, inside
send.sh, and a refusal there aborts the send.
send.sh to an allow rule.inbox.sh reads the sending account over IMAP, through the same SOCKS proxy, with
himalaya 2.x. It is read-only by construction:
$XDG_STATE_HOME/mail-cloak/, removed on exit (a killed run's leftover is swept by
doctor.sh after 1 h). Its proxy is always socks5h://SOCKS_HOST:SOCKS_PORT, so DNS also
resolves at the proxy. It holds no SMTP backend, so it cannot send.read never marks a message \Seen. It runs himalaya message read without
--seen, which fetches BODY.PEEK[]. tests/himalaya-wire-cases.sh checks this on the
wire against a loopback IMAP server, with --seen (which fetches BODY[]) as the
control. That test runs cleartext imap:// over SOCKS; the TLS path sends the same
commands inside TLS and is verified as generated config text only.list and search print one line per message: id, date, from, subject. read
prints the message as text. Nothing is rendered, so no remote image loads and a
tracking pixel cannot reveal the reader. Terminal control sequences are stripped.inbox.sh list or inbox.sh search --from … --subject … --since YYYY-MM-DD.
doctor.sh --read must exit 0 first; msmtp rows do not matter for reading.inbox.sh read <id> with the SAME --folder you listed or searched. Ids are
per-folder UIDs: id 12 in [Gmail]/Spam is not id 12 in INBOX.himalaya,
curl imaps:// or python imaplib: those are unproxied, and the guard asks on them.new-eml.sh … --in-reply-to "<parent Message-ID>" (add
--references with the parent's References to keep a long thread), then
send.sh --dry-run, then send.sh.It protects sends and mailbox changes, and it asks on any read that is not
inbox.sh: himalaya with an explicit config (-c, --config, HIMALAYA_CONFIG), curl
to imap(s):///pop3(s)://, python that uses IMAP, message read --seen, and any
MAIL_CLOAK_* override in front of a plugin script. It cannot make an arbitrary read
proxied: only inbox.sh is. A plain himalaya envelope list with the user's own default
config is allowed, and goes wherever that config says.
| Script | 0 | 1 | 2 |
|---|---|---|---|
egress-check.sh | ok | refused | config error |
send.sh | sent / dry run ok | refused, or not accepted (non-250) | config error |
header-check.sh | PASS (or probe sent, checklist printed) | FAIL or refused | config error |
new-eml.sh | written | — | usage or config error |
inbox.sh | ok, and --help | egress refused, or himalaya failed | usage or config error (no config, no user or password command, imap://, : in the state dir) |
doctor.sh | send-ready (--read: read-ready); WARN allowed | not ready | bad argument |
${MAIL_CLOAK_CONFIG:-$XDG_CONFIG_HOME/mail-cloak/config}, KEY=VALUE, mode 600.
It is parsed, never sourced, so a $(…) in a value is inert text.
| Key | Meaning |
|---|---|
MSMTP_CONFIG | Path to the msmtprc |
MSMTP_ACCOUNT | msmtp account name; its from must equal the .eml From |
SOCKS_HOST / SOCKS_PORT | Default 127.0.0.1 / 25344 |
WIREPROXY_CONFIG | Optional. egress-check starts wireproxy when the port is closed |
PROBE_RECIPIENT | An EXTERNAL mailbox, outside the sending account, for header-check |
ALLOWLIST_FILE | Optional. One address or @domain per line; any other recipient refuses. The prompt is required either way |
IMAP_SERVER IMAP_USER IMAP_PASSWORDCOMMAND | Reading the sending account (inbox.sh). Defaults: imap.gmail.com (implicit TLS); the msmtp account's user; the msmtp account's passwordeval string |
PROBE_IMAP_SERVER PROBE_IMAP_USER PROBE_IMAP_PASSWORDCOMMAND PROBE_IMAP_MAILBOX | Optional. header-check reads the probe back from PROBE_RECIPIENT's mailbox with himalaya, through the proxy. Needs the server and the password command (doctor WARNs when only one is set); user defaults to PROBE_RECIPIENT, mailbox to INBOX (then [Gmail]/Spam) |
Why two key sets. The probe must land in a mailbox outside the sending account (a
self-send proves nothing), so header-check reads a different account than inbox.sh does.
IMAP_* is the account you send from and read; PROBE_IMAP_* is the probe mailbox.
Server grammar (both key sets): a bare host means implicit TLS on 993
(imap.example.com); imaps://host:port names another TLS port; cleartext imap:// is
refused.
Migrating from 1.0.x. These keys are ignored since 1.1.0, and doctor.sh WARNs:
| 1.0.x key | 1.1.0 key |
|---|---|
IMAP_HOST + IMAP_PORT | PROBE_IMAP_SERVER=imaps://host:port (or the bare host for 993) |
IMAP_USER (it was the probe mailbox's user) | PROBE_IMAP_USER |
IMAP_PASSWORDEVAL | PROBE_IMAP_PASSWORDCOMMAND |
IMAP_MAILBOX | PROBE_IMAP_MAILBOX |
IMAP_USER still exists, with a new meaning: the user you read the sending account
as. Next to any other 1.0.x key, and with no PROBE_IMAP_USER, it is taken as the old
meaning and ignored.
A minimal msmtprc account (example values):
defaults
auth on
tls on
tls_starttls on
account example
host smtp.gmail.com
port 587
from [email protected]
user [email protected]
passwordeval "printenv SMTP_PW"
passwordeval under the operator's own secret tool (one that exports
SMTP_PW for the child only), or read the macOS keyring.send.sh passes --proxy-host/--proxy-port explicitly.from equal to user. doctor.sh and send.sh WARN when they differ (a send-as alias).domain unset. It defaults to localhost; a real hostname there leaks in EHLO.A wireproxy config needs WGConfig = <path> plus a [Socks5] section with
BindAddress = 127.0.0.1:<SOCKS_PORT>. Check it with wireproxy -n -c <conf>.
doctor.sh must exit 0 (send-ready). Fix every FAIL row first. A WARN row does not block, but
tell the user about it.egress-check.sh must print "ok": true. A refusal names the reason in one line.
Do not work around it.header-check.sh when doctor's probe-pass row says none: that means first use,
or the account or SOCKS endpoint changed. It asks. With the PROBE_IMAP_* keys it reads the probe back through the proxy and asserts by itself.
Without them it prints the Message-ID and a checklist:
--headers line it prints. A PASS on the probe's headers is recorded.new-eml.sh --to … --subject … --body-file … writes the .eml and prints its path.
Add --cc/--bcc as needed. From defaults to the account's from.send.sh --dry-run <path>. It runs every check, so the sha256 in the next prompt is
the one that gets logged.send.sh <path>. The human approves or declines in the prompt.sent.jsonl and report the Message-ID, the recipients and
smtpstatus=250.curl --socks5-hostname, from
https://www.cloudflare.com/cdn-cgi/trace.Received: from … [IP] hop, the first hop included, lies in the direct /24 or /48.Sender: header.dmarc=pass and dkim=pass in Authentication-Results.d= other than the From domain is a WARNING only.See What the guard is — and isn't above: the guard is best-effort by design.
Sender: header naming the primary account. Send from
the mailbox itself, not from an alias of another account.+tag, and dropping Gmail dots (gmail.com/googlemail.com).domain setting goes into EHLO, and the first Received: header records
it. Keep it at the default localhost.Received: header.d=*.gappssmtp.com means the domain's own DKIM signing is off. DKIM then does
not align, so DMARC rests on SPF alone. That is cosmetic only while the domain's SPF
record includes the provider.BODY.PEEK reads without changing anything.\Seen: see Reading mail. himalaya message read --seen would.What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub kattakath/skills --plugin mail-cloak