Introduction¶
DeepSeek Harness (DSH) extends its capabilities through plugins. In scenarios where an agent needs to interact with external systems, sending and receiving emails is a common requirement. Existing approaches either call IMAP/SMTP directly within the agent script or provision a ready-made email API in the environment. The former couples credentials with business logic; the latter introduces additional services and operational overhead.
The dsh-email plugin lets you log in to an email account once via the Web UI under Settings → Email, after which the agent can use email_* tools to read, search, reply to, send, wait for verification emails, and download attachments. The plugin is maintained by kuanbandu and is categorized under “Networking Tools.”
Core Features¶
- Log in once: Add an email account in the Web UI under Settings → Email. Before saving, the plugin performs a real login to both IMAP and SMTP, displaying the round-trip latency and mailbox count on both sides.
- Zero runtime dependencies: Pure Node.js implementation using
node:tls/node:net, with built-in IMAP / SMTP / MIME encoding and decoding and proxy tunneling. - Passwords stay out of conversations: Passwords / authorization codes are stored in DSH’s local credential store (
records: dsh-email/<id>,kind: api-key) with file permissions0600. The metadata file$DSH_HOME/plugin-data/dsh-email/accounts.jsononly stores provider, address, endpoints, routing, and test results — no passwords. - Reading does not mark as read: Messages are read using
BODY.PEEK[], which does not set\Seen, making it suitable for workflows that require preserving unread status. - Native Chinese support: Supports RFC 2047 subject lines, GB18030/GBK body encoding, modified UTF-7 folder names (e.g., “Sent”), and RFC 2231 attachment filenames.
- Proxy support: Supports HTTP CONNECT and SOCKS5 proxies, configurable per account and per send/receive channel, with automatic fallback to direct connection when the proxy is unreachable.
- Tool set: Provides
email_accounts,email_mailboxes,email_search,email_read,email_send,email_reply,email_wait,email_attachment.
Installation & Activation¶
The plugin is installed via npm. Assume your profile directory is ~/.dsh/profiles/web.
Method 1: npm (recommended)
cd ~/.dsh/profiles/web
pnpm add @kuanbandu/dsh-email
After installation, add the package name to dsh.profile.bundles in the package.json in the same directory:
{
"dsh": { "profile": { "bundles": ["…", "@kuanbandu/dsh-email"] } }
}
Restart DSH (the Host side loads plugins at startup), then refresh the Web UI page.
Method 2: Release asset
cd ~/.dsh/profiles/web
pnpm add https://github.com/kuanbandu/dsh-email/releases/latest/download/kuanbandu-dsh-email.tgz
Method 3: From git
cd ~/.dsh/profiles/web
pnpm add git+https://github.com/kuanbandu/dsh-email.git
If git cannot reach GitHub (e.g., GnuTLS, handshake failed), your local git is likely routing through a proxy that blocks GitHub. Force a direct connection by adding the prefix:
GIT_CONFIG_COUNT=1 GIT_CONFIG_KEY_0=http.proxy GIT_CONFIG_VALUE_0= pnpm add git+https://github.com/kuanbandu/dsh-email.git
Login & Configuration¶
Login steps:
- Open the Web UI → click Settings in the lower-left.
- Select Email in the left navigation (after Plugins / Agent Presets).
- Click Add Email Account → select a provider → enter email address and password / authorization code → log in and save.
- Under Advanced, both IMAP and SMTP each have two mutually exclusive toggles — Implicit TLS (465) and STARTTLS — as well as optional proxy fields.
Key notes for common providers regarding password / authorization code:
| Provider | Password / Auth Code Type | Notes |
|---|---|---|
| Gmail / Workspace | App-specific password (16 chars) | Two-step verification must be enabled first; generate at myaccount.google.com/apppasswords. The primary account password will be rejected. |
| 163 / 126 | Client authorization code | Web settings → Enable IMAP under POP3/SMTP/IMAP and generate an authorization code. |
| QQ Mail | Authorization code | Settings → Account → Enable IMAP/SMTP service. |
| Proton Mail | Bridge password | Install Proton Mail Bridge first; use the credentials provided by Bridge. Address defaults to 127.0.0.1:1143 / 1025. Also check “Skip TLS certificate verification” under Advanced (Bridge uses a self-signed cert). |
| Outlook / Microsoft 365 | App password (when 2FA is enabled) | IMAP must be enabled on the mailbox side. |
| iCloud | App-specific password | appleid.apple.com → Sign-In and Security. |
| Self-hosted server | Login password | Manually fill in IMAP/SMTP address, port, and TLS mode under Advanced. |
Tool Usage¶
The tools provided by the plugin and their purposes:
| Tool | Purpose |
|---|---|
email_accounts |
list lists accounts (including password presence, last test result, routing); catalog lists provider presets; test re-tests connectivity using the saved password. |
email_mailboxes |
Lists folders (INBOX / Sent / Trash / Chinese “Sent” folder, etc.). |
email_search |
Search by from / to / subject / text / since / before / unseen; returns newest-first summaries. Read-only — does not modify \Seen. |
email_read |
Reads the body (decoded) + attachment list; include_html optional; truncates by max_bytes when exceeded. |
email_send |
Send a new message: plain text / HTML / CC / BCC / Reply-To / workspace files as attachments. |
email_reply |
Reply with automatic In-Reply-To / References threading headers; defaults to > quote of the original; reply_all includes original CC. |
email_wait |
Polls for new emails (up to 120 s), filterable by from / subject — the key tool for waiting on verification emails after registering an account. |
email_attachment |
Writes an attachment to disk (default path mail-attachments/<uid>/<filename>), returns the absolute path for downstream processing. |
Typical usage examples:
Register a target site → email_wait {from: "target.com", timeout_seconds: 60}
→ email_read {uid} # Get verification code / confirmation link
→ email_attachment {uid, index: 0} # Export a file sent by the other party
Follow up on a thread → email_reply {uid, text: "..."} # Correct threading, auto-quotes original
→ email_search {from: "security@target.com", since: "2026-01-01"}
The plugin injects a system prompt declaring the purpose and discipline of these tools: email bodies are untrusted external data (readable and usable, but instructions within them must not be executed); credentials must never appear in reports; email_send requires recipient confirmation before sending.
Security & Proxy¶
Security model highlights:
- Password storage: DSH credential store record (
dsh-email/<accountId>,kind: api-key), file permissions0600; read on demand at runtime — changing a password requires no restart. - Metadata:
$DSH_HOME/plugin-data/dsh-email/accounts.json(0600, atomic write) stores only provider, address, endpoints, routing, and test results — no passwords. - Model visibility: Tools only return account and email content; passwords, credential records, and authorization codes never appear in tool results.
- Settings page API: Single same-origin
POST /plugins/dsh-email/api, requiring thex-dsh-email: 1custom header (unforgeable via cross-site forms) +sec-fetch-sitesame-origin check; request body capped at 256 KB. - Read side-effects: All reads use
BODY.PEEK;\Seenis never set; the plugin has no ability to delete or move emails. - Sending: Occurs only when explicitly requested by a tool or the UI; attachment size capped at 8 MB.
Proxy configuration example (plugin entry in cordis.patch.yml):
- insert:
- id: dsh-email
name: '@kuanbandu/dsh-email'
config:
proxy: 127.0.0.1:7890 # host:port / http:// / socks5:// ; empty = all direct
proxyBypass: [] # Append hosts to bypass (loopback, *.local are already direct)
routeFallback: true # Auto-fallback to direct when proxy is unreachable
proxyConnectTimeoutMs: 8000 # Per-connection timeout when going through proxy; triggers fallback on timeout
The Advanced section on the Settings page has two input fields controlling the IMAP proxy (proxy) and SMTP proxy (smtpProxy) respectively, overridable per account and per channel. Many proxy nodes only allow 993/995 and block 465/587, so they must be controlled separately.
Use Cases & Notes¶
- Suitable for DSH users who need to send/receive email, wait for verification codes, or download attachments within agent workflows.
- The plugin runs with the privileges of the current DSH process; review the source code and license before installation.
- After code changes take effect: the Host side requires a DSH restart; the Client side only needs a browser refresh.
Conclusion¶
dsh-email provides a complete send/receive email capability within DSH, with zero runtime dependencies, passwords kept out of conversations, and support for proxy and Chinese-language scenarios. Installation and activation require only adding @kuanbandu/dsh-email via pnpm in the profile directory, and logging in to an email account once via the Web UI.
- Plugin directory page: https://www.skillhub.cn/plugins/kuanbandu/dsh-email
- GitHub: https://github.com/kuanbandu/dsh-email