universal-email

软件研发 视频与文档 16 文件 中英

用 Himalaya CLI 收发 IMAP/SMTP 邮件

Use the bundled Himalaya 2 CLI to connect IMAP/SMTP or Microsoft Graph mailboxes and list, search, read, compose, reply, forward, move, delete, flag, and download email. Use when the user asks to connect or operate Gmail, QQ Mail, iCloud Mail, Outlook, or another standard mailbox, or says "连接邮箱"、"绑定邮箱"、"看看我的邮件"、"查邮箱"、"发邮件"、"回复邮件".

说明语言:中英混合

来源marswaveaiskills ↗ 查看原文件 ↗版权归原作者,请遵循原仓库许可
安装
npx skills add https://github.com/marswaveai/skills --skill universal-email

需要已安装 skills CLI。也可以直接从源仓库 clone。

在星云中查看 ↗
SKILL.md 原文

name: universal-email description: Use the bundled Himalaya 2 CLI to connect IMAP/SMTP or Microsoft Graph mailboxes and list, search, read, compose, reply, forward, move, delete, flag, and download email. Use when the user asks to connect or operate Gmail, QQ Mail, iCloud Mail, Outlook, or another standard mailbox, or says "连接邮箱"、"绑定邮箱"、"看看我的邮件"、"查邮箱"、"发邮件"、"回复邮件". metadata: version: 1.2.9 requires: bins: ["himalaya"] ---

Email (universal-email)

Serve the user the Cola way

These rules govern everything you SAY. They never change which commands you RUN — all operations below stay exactly as written.

Use the bundled himalaya executable. This Skill targets exactly Himalaya 2.0.0 at revision 923414155f4281d681f4ea8631954f406acf51ee; do not use Himalaya 1.x configuration fields or command examples.

Locate the executable

Always use the copy bundled with this Skill; never a himalaya that happens to be on PATH, which may be an unrelated version. Resolve it once per session:

  1. Determine the platform directory — on macOS run uname -m (arm64 → darwin-arm64, x86_64 → darwin-x64); on Windows use win32-x64.
  2. Resolve scripts/bin/<platform>/himalaya against this document's directory — on Windows the file is himalaya.exe — and use that absolute path for every command below.

This package ships macOS and Windows builds only. On any other platform there is no bundled copy, so fall back to a himalaya on PATH after confirming himalaya --version reports v2.0.0; a different version there is unusable and should be reported as such.

The examples below write the command by its bare name for readability; always run the resolved absolute path instead.

If that file is missing, report that the mailbox is not ready yet — never describe it as an account problem or a broken connector.

Treat the active configuration of the executable you invoke as the source of truth: do not inspect candidate config files to choose one, or add --config merely because a file exists. Use --config only when the user explicitly requests a separate profile.

使用场景

Choose the account

  1. Confirm the resolved executable reports himalaya v2.0.0.
  2. Run himalaya --json account list.
  3. If the intended account exists, select it with the global --account <name> option.
  4. If it does not exist, read the matching provider guide before asking the user for anything:
  5. Gmail: references/gmail.md
  6. QQ Mail: references/qq.md
  7. iCloud Mail: references/icloud.md
  8. Outlook/Microsoft 365: references/outlook.md
  9. Other IMAP/SMTP: references/standard-imap-smtp.md
  10. If configuration is missing, use references/configuration.md for the Himalaya 2 TOML format and active-configuration rules.
  11. Validate with himalaya --account <name> --json account check before any mailbox operation.

Do not ask for a normal account password when the provider requires an app password, authorization code, or OAuth. Never echo a secret, put it in command arguments, or store it as password.raw.

Read operations

Prefer global --json for machine-readable output.

himalaya --account <name> --json mailbox list
himalaya --account <name> --json envelope list --mailbox inbox --page 1 --page-size 20
himalaya --account <name> --json envelope search --mailbox inbox from [email protected] and subject report
himalaya --account <name> --json message read --mailbox inbox <message-id>
himalaya --account <name> --json attachment list --mailbox inbox <message-id>
himalaya --account <name> attachment download --mailbox inbox --dir <directory> <message-id> <attachment-id>

IDs are scoped to their mailbox. Re-list after switching mailboxes or after move/delete operations. Do not repeatedly fetch the same message when one message read --json result already contains the needed fields.

Write operations

Show the final recipients, subject, and body to the user and obtain confirmation immediately before sending, replying, forwarding, moving, or deleting.

Check the backend before writing. message compose|reply|forward --send routes through SMTP or JMAP only, so an account on the Microsoft Graph backend cannot send with it. Read the account's backend from account list first; for a Graph account, send through himalaya msgraph message send with raw MIME and read references/outlook.md before composing.

himalaya --account <name> message compose \
  --from [email protected] \
  --to [email protected] \
  --subject "Subject" \
  --body "Body" \
  --send

himalaya --account <name> message reply --mailbox inbox \
  --body "Reply body" --send <message-id>

himalaya --account <name> message forward --mailbox inbox \
  --to [email protected] --body "Forward note" --send <message-id>

For attachments and raw RFC 5322 messages, read references/message-composition.md.

Never retry a send automatically after an ambiguous error. SMTP delivery can succeed before saving a copy to the Sent mailbox fails; verify delivery before any retry.

Organize mail

himalaya --account <name> message move --from inbox --to archive <message-id>
himalaya --account <name> message copy --from inbox --to important <message-id>
himalaya --account <name> flag add --mailbox inbox --flag seen <message-id>
himalaya --account <name> flag remove --mailbox inbox --flag seen <message-id>
himalaya --account <name> message delete --mailbox inbox <message-id>

message delete is trash-first, but permanently removes messages already in trash. State this consequence and get explicit confirmation.

Network and troubleshooting

Himalaya 2 supports SOCKS5 and HTTP CONNECT, and takes its route only from the environment of each invocation. Operating-system proxy settings are a discovery source, not a route: a proxy configured in macOS or Windows settings but absent from the process environment is not used, so reading it and then running the command unchanged tests the direct route while appearing to test the proxy. To exercise a discovered setting, pass it explicitly in that invocation's environment, and preserve the protocol exactly as reported — never infer one from a port number.

Himalaya has no proxy configuration field or CLI flag: the route comes only from the environment of each invocation, and this build reads exactly two variables — all_proxy first, then https_proxy. http_proxy is not consulted at all, so a proxy supplied only through it is silently ignored and the command runs direct; carry such a value over into https_proxy for the invocation. This environment is the one lever for per-command route isolation. To force a single command onto the direct route, clear both variables for that invocation only, without touching the user's global proxy. On macOS use env -u all_proxy -u https_proxy <himalaya> --account <name> ...; in PowerShell, env does not exist, so scope the change to the process instead:

# A child process, so the user's proxy stays intact in this session.
powershell -NoProfile -Command @'
Remove-Item Env:all_proxy -ErrorAction SilentlyContinue
Remove-Item Env:https_proxy -ErrorAction SilentlyContinue
& '<himalaya>' --account <name> ...
'@

Never assign $env: values directly in the working session: they persist, and every later command would silently run without the user's proxy. Confirm the route actually used from Himalaya's own dial <host>:<port> ... (source: direct|all_proxy|https_proxy) debug line rather than assuming it.

Read references/proxy.md before connecting or diagnosing when any of these conditions applies:

That guide defines the routing defaults for Gmail, QQ Mail, iCloud Mail, Outlook, and custom IMAP/SMTP; macOS and Windows proxy discovery; per-command route isolation; and error-specific recovery. Do not ask the user to edit global proxy settings.

Use its error mapping as recovery guidance. When an observed error matches a known case, move the diagnosis in the stated direction using the current device's available controls. Do not merely restate the protocol, port, or timeout to the user and stop, and do not assume that every device exposes proxy controls in the same way.

Use the actual CLI path:

himalaya --account <name> --log-level debug account check

Verify the selected route from Himalaya's own debug line before interpreting the result. Do not use nc, telnet, or a direct socket probe as proof of Himalaya connectivity because those checks bypass its proxy selection. Read references/troubleshooting.md for non-network failures and the staged diagnostic flow.

Do not discard the diagnostic stages before interpreting a timeout. Inspect the bounded command output first, then retain and report only safe route and stage information.

同类技能
cola-avatar-packcontent-parsercreatordocument-illustratorembedded-captionsexplainerfaceless-explainergoogle-calendar-skill
本页内容来自开源项目 marswaveai, 版权归原作者所有。
本站仅作技能索引与分享,所有 Skill 版权归其原作者所有。