Introduction¶
When running agents on DSH, common entry points are local web interfaces or IDE sidebars: humans need to watch the interface, and sessions are tied to foreground processes on the same machine. If you want to “start a task round by sending an email” and “automatically continue context via replies,” without exposing public ports on the machine or configuring callback URLs, you need a purely outbound email channel.
Below is the community plugin dsh-mail (maintainer secondlgn): it binds a dedicated mailbox to a machine, polls incoming emails via IMAP, and sends replies via SMTP. Reply determination relies on message headers and subject tags, and long-running tasks can even be interrupted by replies within the same thread. The plugin is categorized as a Client and currently has 0 GitHub stars; for design trade-offs, see the repository’s docs/design-spec.md.
What is this¶
dsh-mail is a Host plugin (ESM) for DSH, which also includes a bundle patch cordis.patch.yml to insert plugin lines into the profile. In one sentence: One dedicated mailbox per machine; email is the session, replies continue the context, and replies are automatically sent back.
Unlike “Webhook + Public Service” integrations, it emphasizes:
- Pure Outbound: The machine does not require a public IP, does not open inbound ports, and has no callback addresses.
- Access via Whitelist: Only accepts exact addresses in
From; others are discarded without receipt. - Zero Runtime Dependencies: IMAP/SMTP and MIME parsing are implemented within the package using only Node built-in modules (the repository
package.jsonrequires Node>=22.0.0).
Core Features¶
The following capabilities are marked as implemented in the README and verified in offline simulations.
Sending, Receiving, and Access Control¶
- IMAP polling for incoming mail (supports
IDLE, falls back to polling based onpollIntervalMsif unavailable); SMTP for sending, with optional write-back to the Sent folder. allowFromwhitelist: If empty, no one can drive this machine (secure by default, not a bug).- Loop mail suppression; emails exceeding
maxMessageBytes(default 32 MiB) are discarded.
Sessions and Threads¶
Reply determination uses a double safeguard:
- Prioritizes
In-Reply-To/Referencespointing to our Message-ID; - Falls back to the
[dsh-xxxx]tag in the subject (prefix configured bytagPrefix, default[dsh-).
If neither matches, a new session is created. Duplicate emails with Message-IDs already processed will be discarded.
Receipts, Results, and Interruptions¶
| Timing | Content Summary | |
|---|---|---|
| Acknowledgement | Immediately after passing admission | Contains receipt number and session number for subsequent continuation |
| Result Reply | Normal round end | Assistant text for that round; interrupted / forked do not send results |
interruptSameThread defaults to true: It only interrupts if the reply belongs to the session currently running; the implementation is “queue first, then cancel,” allowing the new prompt to take over the current round.
Attachments and State¶
- Attachments can be saved to
<workspace>/.dsh-mail/attachments(subject toattachments.*limits). - The state directory defaults to
<DSH_HOME>/mail, containingmessages.json,threads.json,cursor.json; writes are atomic, and unfinished mails can be replayed viarecovery(defaultrerun) in case of a crash.
Not Yet Implemented (Defined as subsequent phases in the README)¶
Phase reporting based on plan todo, permission lists, and out-of-scope inquiries.
Interface Configuration¶
The repository includes a browser-side lib/client.js, but the README explicitly states: Do not expect the Web-side “Mail Channel” card to be editable for configuration yet—the runtime schemastery is incompatible with .volatile(), causing the plugin line to fail to start. Before this is resolved, please directly modify the profile’s cordis.patch.yml and restart DSH after making changes.
Installation and Enablement¶
This plugin is a standard DSH Host plugin package. Follow the README for installation: configure dependencies and bundles in the profile directory ($DSH_HOME/profiles/<name>/), and use a patch to override the complete config for the dsh-mail line (the patch replaces the entire line’s config; you cannot write incremental changes).
1. Get Plugin Source Code¶
The method provided in the README is to clone the repository from GitHub (adjust the path according to your local machine):
git clone https://github.com/secondlgn/dsh-mail
2. Modify the profile’s package.json¶
Point to the local path or GitHub source in dependencies, and add dsh-mail to dsh.profile.bundles (otherwise, the bundled patch will not be inserted):
// <profile>/package.json
{
"dependencies": {
"dsh-mail": "file:C:/path/to/dsh-mail",
// "dsh-mail": "github:secondlgn/dsh-mail"
},
"dsh": {
"profile": {
"bundles": ["@deepseek-ai/dsh-base", "@deepseek-ai/dsh-web-app", "dsh-mail"]
}
}
}
3. Write full configuration in cordis.patch.yml¶
Do not write name: for the entry in the profile patch (it will be silently ignored and the plugin will never load); override the configuration strictly by id: dsh-mail. Use passwordEnv for passwords (default DSH_MAIL_PASSWORD) and do not write them into the YAML.
# <profile>/cordis.patch.yml
- id: dsh-mail
config:
enabled: true
imap:
host: imap.example.com
port: 993
user: agent@example.com
passwordEnv: DSH_MAIL_PASSWORD
smtp:
host: smtp.example.com
port: 465
user: agent@example.com
allowFrom:
- you@example.com
workspaceDir: C:/work
workspaceDir determines the working directory for the mailbox session, which varies per machine and must be an existing absolute path; if left empty, the current working directory is used.
4. Verification¶
After restarting DSH, the plugin line should appear as include:dsh-mail with a status of active. If it does not appear, check in order: whether bundles contains dsh-mail, whether the patch mistakenly writes name:, and whether package.json is valid JSON.
NetEase Mailbox (163/126/yeah)¶
You need to enable IMAP/SMTP in the mailbox settings and use an authorization code. The plugin automatically sends the RFC 2971 ID command when CAPABILITY contains ID; the Sent folder is identified via \Sent, requiring no manual sentMailbox configuration. Reference:
- id: dsh-mail
config:
enabled: true
imap:
host: imap.163.com
port: 993
user: you@163.com
passwordEnv: DSH_MAIL_PASSWORD
smtp:
host: smtp.163.com
port: 465
user: you@163.com
passwordEnv: DSH_MAIL_PASSWORD
allowFrom: [you@163.com]
Read-only Self-Check before Production¶
In the repository root directory, with the environment variable DSH_MAIL_PASSWORD set:
node tools/mail-probe.mjs you@163.com
node tools/mail-rehearsal.mjs you@163.com
Neither script sends emails, writes state, or marks emails as read.
Typical Usage¶
- Configure IMAP/SMTP and
allowFrom, setworkspaceDir, and restart DSH to confirm the plugin isactive. - Send a new email from a whitelisted address to the agent’s mailbox; the subject and body serve as the initial prompt. After receiving the acknowledgment receipt, note the session number
[dsh-xxxx]inside it. - Reply within the same email thread (or retain the subject tag); the content will continue that session. If that session is currently running a round and
interruptSameThreadis true, the new reply will interrupt the current round. - After the round ends, a result email will be received (plain text, subject to limits like
maxResultChars); inbound attachments are saved to the workspace.dsh-mail/attachmentsif enabled.
Inbound content is wrapped with a layer of “Email Mode” meta-information before being sent to the model (explaining plain text output, line width control, etc.). For details, see the “Email Mode Prompt” section in the README.
Common Configuration Options (Excerpt)¶
Refer to the GitHub README for the complete table. Here is an excerpt of options relevant to daily use:
| Key | Default | Description |
|---|---|---|
enabled |
true |
Does not establish connections if disabled |
allowFrom |
[] |
Senders allowed to drive the agent (exact match) |
imap.pollIntervalMs |
20000 |
Polling interval (effective lower bound 2000) |
sendReceipt / sendResult |
true |
Acknowledgment receipt / Result reply |
interruptSameThread |
true |
Reply in the same thread interrupts the current round |
agentPreset |
'' |
Agent preset for the mailbox session; uses profile default if empty |
stateDir |
<DSH_HOME>/mail |
Plugin state directory |
Scenarios and Cautions¶
Who is it for: Users who need to remotely drive a DSH agent on a machine via a mobile phone or any email client without exposing inbound ports; users who want “email thread = session thread” and rely on receipt numbers and [dsh-xxxx] tags to continue context.
Must Know:
- The plugin runs with the permissions of the current DSH process;
allowFromis equivalent to a remote execution entry point. Read the source code and license (MIT) before installation, and only trust whitelisted addresses. - The community directory skillhub.cn has no official affiliation with DeepSeek / High-Flyer; the DSH ecosystem philosophy is “Everything is a Plugin.” The factual sources for this article are the repository README and
package.json(current version 0.1.0). - Delivery semantics are at-least-once: If the process crashes between “delivered” and “marked complete,” it may replay. The README considers duplicate answers more acceptable than missing emails.
Conclusion¶
dsh-mail turns a “dedicated mailbox” into a session channel for DSH: pure outbound IMAP/SMTP, whitelist access, double-safeguard context continuation via headers and subject tags, same-thread interruption, and automatic receipt/result emails, with no additional npm runtime dependencies. If your deployment model is “one agent mailbox per machine,” you can integrate it via profile + cordis.patch.yml and use the tools/ scripts for read-only self-checks before enabling.
- Directory Page: https://www.skillhub.cn/plugins/secondlgn/dsh-mail
- Source Code & Docs: https://github.com/secondlgn/dsh-mail