hermes - 💡(How to fix) Fix 163 mailbox IMAP connection fails - Missing IMAP ID extension support [2 pull requests]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…

Error Message

When connecting to 163 mailbox (NetEase) via IMAP, the connection fails with error: IMAP login succeeds, but 163 immediately blocks subsequent operations with "Unsafe Login" error. SMTP works fine (using auth code).

Root Cause

163 mailbox requires IMAP ID extension (RFC 2971) to be sent after login. The client must identify itself with name, version, vendor, support-email fields.

Without sending the ID command after store.connect(), 163 treats the client as "unsafe" and blocks the connection.

Fix Action

Fixed

Code Example

Unsafe Login. Please contact kefu@188.com for help

---

HashMap IAM = new HashMap();
IAM.put("name","myname");
IAM.put("version","1.0.0");
IAM.put("vendor","myclient");
IAM.put("support-email","[email protected]");

store.connect("[email protected]", "auth_code");
store.id(IAM);  // ← Must be called after connect()

---

import imaplib

# Add ID command support
imaplib.Commands["ID"] = "AUTH"

# After login
conn = imaplib.IMAP4_SSL("imap.163.com", 993)
conn.login(user, password)

# Send ID (required by 163)
conn._simple_command("ID", '("name" "hermes-agent" "version" "0.13.0" "vendor" "NousResearch" "support-email" "[email protected]")')

---

email:
  imap_id:
    enabled: true
    name: "hermes-agent"
    version: "0.13.0"
    vendor: "NousResearch"
    support-email: "[email protected]"
RAW_BUFFERClick to expand / collapse

Bug Description

When connecting to 163 mailbox (NetEase) via IMAP, the connection fails with error:

Unsafe Login. Please contact [email protected] for help

Root Cause

163 mailbox requires IMAP ID extension (RFC 2971) to be sent after login. The client must identify itself with name, version, vendor, support-email fields.

Without sending the ID command after store.connect(), 163 treats the client as "unsafe" and blocks the connection.

Official Requirement (from 163 help center)

When using IMAP protocol, the system requires your client to provide identity information before allowing connection.

163 provides Java example:

HashMap IAM = new HashMap();
IAM.put("name","myname");
IAM.put("version","1.0.0");
IAM.put("vendor","myclient");
IAM.put("support-email","[email protected]");

store.connect("[email protected]", "auth_code");
store.id(IAM);  // ← Must be called after connect()

Reference: https://www.ietf.org/rfc/rfc2971.txt

Expected Behavior

Hermes Agent's email platform should:

  1. Detect if the IMAP server supports ID extension (CAPABILITY ID)
  2. After successful login, automatically send ID command with client identity
  3. Allow users to configure identity fields in config.yaml or .env

Current Behavior

IMAP login succeeds, but 163 immediately blocks subsequent operations with "Unsafe Login" error. SMTP works fine (using auth code).

Environment

  • Hermes Agent version: v0.13.0 (2026.5.7)
  • Email provider: 163.com (NetEase)
  • IMAP server: imap.163.com:993 (SSL)
  • Auth method: Authorization code (not password)

Suggested Fix

In hermes_agent/platforms/email/imap_client.py (or equivalent):

import imaplib

# Add ID command support
imaplib.Commands["ID"] = "AUTH"

# After login
conn = imaplib.IMAP4_SSL("imap.163.com", 993)
conn.login(user, password)

# Send ID (required by 163)
conn._simple_command("ID", '("name" "hermes-agent" "version" "0.13.0" "vendor" "NousResearch" "support-email" "[email protected]")')

Additional Context

Feature Request

Add a configuration option in config.yaml:

email:
  imap_id:
    enabled: true
    name: "hermes-agent"
    version: "0.13.0"
    vendor: "NousResearch"
    support-email: "[email protected]"

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING