当前位置: 首页 > Skill >

126 Mail Cleanup

126 Mail Cleanup

126 Mail Cleanup

当用户想要清理、备份或优化其126.com(网易)邮箱时使用此技能。包括本地备份、批量删除垃圾邮件/订阅等。

1.0.0 2026.11.25 632
获取Skill文件查看使用说明
作 者:苏宁 许可证: 更新时间:2026.11.25
本文目录展开

126 Mail Cleanup

A step-by-step assistant for cleaning up, backing up, and optimizing your NetEase 126.com email account via IMAP. Designed to help reclaim cloud storage, reduce clutter, and create a reliable local archive.

Why Use This Skill

  • Local backup: Download all emails and attachments to your machine — you own your data, not the cloud
  • Cloud storage savings: 126 free accounts have limited space (typically 3-5GB); stripping large attachments can reclaim gigabytes, avoiding the need to pay for premium storage
  • Inbox hygiene: Bulk-delete years of accumulated ads, subscriptions, and platform notifications while preserving important personal emails
  • Safety first: Every destructive operation has a preview, confirmation, and backup step — nothing is permanently deleted without your approval

Commands

Command Description
/126mail setup Configure IMAP credentials and verify connection
/126mail backup Download emails to local storage (supports resume)
/126mail classify Scan and classify all emails by sender domain
/126mail cleanup Interactively bulk-delete ads/subscriptions
/126mail strip Download large attachments locally, then replace originals with lightweight stubs on server
/126mail status Show current mailbox stats and cleanup progress

Setup — Step by Step

Step 1: Enable IMAP Access on 126.com

  1. Log in to https://mail.126.com in a browser
  2. Go to Settings (设置) > POP3/SMTP/IMAP
  3. Enable IMAP/SMTP Service
  4. Generate an Authorization Code (授权码) — this is NOT your login password
  5. Save this code securely

Step 2: Configure the Skill

Provide your credentials when prompted:

MAIL126_ADDRESS=your_email@126.com
MAIL126_AUTH_CODE=your_authorization_code

Step 3: Verify Connection

Run /126mail setup to test the IMAP connection. The skill will:

  • Connect to imap.126.com:993 (SSL)
  • Send the required ID command (126 rejects clients without it)
  • List all folders with email counts and total sizes

IMAP API Reference

126.com IMAP has several quirks. This skill handles them automatically, but here is the reference for transparency:

Connection Requirements

Item Value
Server imap.126.com
Port 993 (SSL)
Auth LOGIN with authorization code (not password)
ID Command REQUIRED — must send ID ("name" "IMAPClient" "version" "1.0.0" ...) after login, or server rejects operations

Folder Name Encoding (Modified UTF-7)

Chinese folder names are encoded. Common mappings:

Display Name IMAP Name
已发送 (Sent) &XfJT0ZAB-
草稿箱 (Drafts) &g0l6P3ux-
已删除 (Trash) &XfJSIJZk-
垃圾邮件 (Spam) &V4NXPpCuTvY-

Rate Limits

Operation Limit
FETCH (download) ~4GB per session before throttling
SEARCH, SIZE queries Unlimited
UID SEARCH ALL ~3 seconds
UID SEARCH FROM ~35 seconds per query
UID COPY ~0.25 sec/email, optimal batch = 50

Critical Rule: Always Use UID, Never Sequence Numbers

This is the most important lesson. IMAP sequence numbers shift after any deletion. If you delete email #5, then email #6 becomes #5, #7 becomes #6, etc. Using sequence numbers after deletions WILL operate on wrong emails. Always use UID FETCH, UID STORE, UID COPY, UID SEARCH.

Phase 1: Local Backup (/126mail backup)

What It Does

  • Downloads all emails (including attachments) from all folders
  • Saves each email as message.eml with a _meta.json sidecar
  • Organized as: backup_dir/folder_name/UID_subject/
  • Supports resume on interruption — tracks progress in _download_progress.json

Batch Strategy

  • Downloads in batches of 500 emails or 4GB (whichever comes first)
  • Pauses between batches to avoid hitting 126's rate limit
  • Reconnects every 20 emails to prevent timeout
  • Socket timeout set to 300 seconds for large attachments

Key Decisions for User

Decision Options Recommendation
Which folders to back up All / INBOX only / Custom Start with INBOX + Sent
Include attachments Yes / Skip large ones Yes (they're your data)
Batch size 100-500 emails 500 (maximize before rate limit)

Phase 2: Email Classification (/126mail classify)

What It Does

  1. Fetches metadata (subject, from, to, date, size) for ALL emails via IMAP — no content download needed
  2. Groups emails by sender domain
  3. Classifies into categories:
    • Platform/Ads: LinkedIn, Amazon, PayPal, JD, Taobao, etc.
    • Financial Notifications: Banks, brokers, payment services
    • Services: Cloud, SaaS, travel booking
    • Personal: Individual senders, known contacts
  4. Outputs all_emails_meta.json (full index) and email_classification.json

Metadata-First Approach

  • SEARCH and ENVELOPE operations are NOT rate-limited on 126
  • Can index 40,000+ emails in minutes
  • UID is tagged on every record for later operations

Key Decisions for User

Decision Options Recommendation
Classification strictness Aggressive / Conservative Conservative — review before delete
Time cutoff for deletion All time / Before 2025 / Custom Before current year (keep recent)
Domain whitelist Auto / Manual review Always manually review KEEP list

Phase 3: Bulk Cleanup (/126mail cleanup)

What It Does

  1. Shows classified email counts by category
  2. User reviews and approves DELETE_DOMAINS list and KEEP_DOMAINS list
  3. Safety net: Copies target emails to a staging folder (e.g., "广告邮件") BEFORE deleting from INBOX
  4. Deletes from INBOX via UID STORE +FLAGS Deleted + EXPUNGE
  5. Random-sample verification (10 emails spot-checked)

The Safe Deletion Flow

INBOX emails  ──UID COPY──>  广告邮件夹 (staging copy)
     │
     └── UID STORE Deleted + EXPUNGE (remove from INBOX)

User verifies in web client...

广告邮件夹  ──permanent delete──>  Gone (only after user confirms)

Key Decisions for User

Decision Options Recommendation
Deletion scope By domain / By category / By date By domain — most precise
Staging folder Create new / Use existing Create "广告邮件" for review
When to purge staging Immediately / After 7 days / Manual Manual — check in web client first
Verification sample size 5 / 10 / 20 10 random emails

Common DELETE_DOMAINS Reference

linkedin.com, crunchbase.com, amazon.com, jd.com, 
service.taobao.com, airbnb.com, booking.com, uber.com,
ctrip.com, trip.com, godaddy.com, coursera.org,
service.netease.com, insideapple.apple.com,
accounts.google.com, intl.paypal.com, citibank.com,
mail.meituan.com, sf-express.com, ...

Common KEEP_DOMAINS Reference

svb.com, gusto.com, berkeley.edu, alibaba-inc.com,
live.com, 139.com, pku.edu.cn, ...

Always let the user review and customize these lists based on their own email history.

Phase 4: Large Attachment Stripping (/126mail strip)

What It Does (Two-Phase Safety Process)

Phase A — Download Only (read-only, no server changes)

  1. Search all folders for emails > threshold (default 50MB)
  2. Download each email's attachments to local backup
  3. Save metadata (_meta.json) for each
  4. Track progress in _progress.json
  5. Reconnect every 5 emails to avoid timeout

Phase B — Strip and Replace (destructive, requires explicit confirmation)

  1. For each downloaded email:
    • Fetch the full message with FLAGS and INTERNALDATE
    • Remove attachment parts from the MIME structure
    • Append a notice: [附件已移除 - 已备份到本地] with file list and original size
    • Upload the lightweight replacement (preserving original flags and date)
    • Delete the original heavy email
  2. Track progress — resumable if interrupted

Storage Savings Example

Before After Saved
70 emails @ 50-200MB each 70 emails @ 5-50KB each ~3.4GB

Key Decisions for User

Decision Options Recommendation
Size threshold 10MB / 20MB / 50MB / 100MB 50MB (best ROI)
Which folders All / INBOX only All folders
Verify downloads before stripping Yes / Skip Always Yes — Phase B is destructive

Error Handling

Error Cause Resolution
LOGIN failed Wrong auth code or IMAP not enabled Re-generate authorization code at 126 settings
ID command rejected Missing ID command after login Skill sends ID automatically — report if this occurs
FETCH timeout Rate limit hit (~4GB) Save progress, wait 1-2 hours, resume
BAD command Folder name encoding wrong Skill uses correct Modified UTF-7
Sequence number mismatch Used sequence instead of UID Skill always uses UID operations

Progress Tracking

All operations save progress to JSON files:

  • _download_progress.json — Full backup progress
  • _progress.json — Large email strip progress
  • cleanup_progress.md — Human-readable summary

This means every operation is resumable. If your connection drops, rate limit hits, or you close your laptop — just run the command again and it picks up where it left off.

Recommended Workflow

  1. /126mail setup — Connect and verify
  2. /126mail status — See current mailbox state
  3. /126mail backup — Full local backup (run multiple times if rate-limited)
  4. /126mail classify — Index and classify all emails
  5. /126mail cleanup — Review and bulk-delete ads/subscriptions
  6. /126mail strip — Reclaim space from large attachments
  7. /126mail status — Verify results

Technical Notes

  • Python 3.6+ with imaplib and email (standard library only, no pip dependencies)
  • All IMAP operations use SSL (port 993)
  • Modified UTF-7 encoding handled automatically for Chinese folder names
  • ID command sent on every connection to satisfy 126's requirement
  • All file names sanitized to remove illegal characters
  • Duplicate attachment filenames handled with suffix numbering

推荐文章

更多
PHP时间戳与日期字符串相互转换方法详解

本文介绍PHP中时间数值(Unix时间戳)与日期字符串之间的相互转换方法。通过strtotime和date函数,实现将当前时间、指定日期转换为时间戳,以及将时间戳格式化为可读的日期时间字符串,并提供相关在线计算工具推荐。

2025.11.30 1,034
PHP日期转时间戳时区偏差怎么解决

在 PHP 中将日期字符串转换为时间戳时,若未显式指定时区,默认使用脚本配置的 date.timezone 或系统时区。当服务器时区与业务逻辑预期(如 UTC )不一致时,会产生偏差。解决核心是确保输入字符串携带明确时区信息,或在转换前统一设置时区上下文。

2026.10.24 1,031
PHP跨域配置:怎么安全地允许指定域名而非使用通配符

在 PHP 中安全地允许指定域名跨域,核心是解析请求头中的 Origin ,验证其是否在白名单内,然后动态设置 Access-Control-Allow-Origin 响应头。不要使用通配符 * ,也不要硬编码单一域名。

2025.03.29 1,019
JavaScript中利用replace结合正则实现replaceAll效果

JavaScript原生仅支持replace()进行单次或全局替换,缺乏类似Java的replaceAll()便捷方法。本文总结四种在JS中实现全量替换的方案:使用带g标志的正则、带gm标志的正则、扩展String原型以及split后join。通过对比代码示例,展示各方法的实现细节与适用场景,帮助开发者根据需求选择最优解。

2025.04.29 1,017
PHP实现基础文件上传:HTML表单与$_FILES处理流程

在 HTML 表单中设置 enctype="multipart/form-data" ,并在 PHP 后端通过 $_FILES 数组接收文件,调用 move_uploaded_file() 将临时文件移动到目标目录即可完成上传。

2026.09.07 1,014
OpenAI的Jalapeno芯片未落地,教你分辨300兆瓦算力消息

OpenAI计划在SB Energy租赁的数据中心部署约300兆瓦自研Jalapeno推理芯片,但目前双方仍处于洽谈阶段,交易细节与上线时间表均未公布。本文带你按报道原文核实项目所处阶段,厘清芯片发布、电力功率与实际推理算力的边界,并将融资意向与签约、开工、投运节点分开追踪,避免误将规划容量计入现有算力。

2026.12.02 1,013
Skill 文件
  • SKILL.md
    • 126 Mail Cleanup
    • Why Use This Skill
    • Commands
    • Setup — Step by Step
      • Step 1: Enable IMAP Access on 126.com
      • Step 2: Configure the Skill
      • Step 3: Verify Connection
    • IMAP API Reference
      • Connection Requirements
      • Folder Name Encoding (Modified UTF-7)
      • Rate Limits
      • Critical Rule: Always Use UID, Never Sequence Numbers
    • Phase 1: Local Backup (/126mail backup)
      • What It Does
      • Batch Strategy
      • Key Decisions for User
    • Phase 2: Email Classification (/126mail classify)
      • What It Does
      • Metadata-First Approach
      • Key Decisions for User
    • Phase 3: Bulk Cleanup (/126mail cleanup)
      • What It Does
      • The Safe Deletion Flow
      • Key Decisions for User
      • Common DELETE_DOMAINS Reference
      • Common KEEP_DOMAINS Reference
    • Phase 4: Large Attachment Stripping (/126mail strip)
      • What It Does (Two-Phase Safety Process)
      • Storage Savings Example
      • Key Decisions for User
    • Error Handling
    • Progress Tracking
    • Recommended Workflow
    • Technical Notes
  • 项目或源文件

相关 Skill

更多
service-qa-coach service-qa-coach Review support quality for chat, email, phone, social DM, or marketplace service teams. Use when a team needs a QA scorecard, failure-mode analysis, coaching plan, calibration checklist, or service-improvement brief without live ticketing, CRM, or contact-center system access.
高中数学作业批改助手 高中数学作业批改助手 >图片识别 直接读取学生手写作答照片,识别公式、符号、步骤 🧮 自动推导 根据题目自动生成参考答案和评分细则,无需教师预设 📊 逐步给分 每个关键步骤独立评分,体现过程分 📝 结构化报告 输出含识别内容、参考答案、逐步评分、改进建议的完整报告 🗂 批量批改 支持一次性批改多道题,最终汇总得分表
Vibration Analysis Vibration Analysis 分析来自CMS趋势、RMS/峰值、频谱及SCADA报警的风机传动链(主轴、齿轮箱、发电机)振动数据。
Traditional Bone Tool Making Basics Traditional Bone Tool Making Basics Use when you need custom, durable, repairable tools like awls, needles, scrapers, harpoons, or fishing hooks made from local animal bones or antlers and comm...
音频混音工具 音频混音工具 名称:Sound Mixing Tool(标识 sound-mixing-tool) 短简介(≤60字):音乐/音效响度精确对齐 + 融合混音工作流:用 ffmpeg 两段式 loudnorm 把多组素材 LUFS 偏差压到 <0.10,再最小干预融合、导出可进引擎的独立分轨。 标签/关键词:音频混音 响度匹配 LUFS ffmpeg 游戏音频 音效设计 Wwise FMOD 分轨导出 后期处理 触发词:混音 · 响度匹配 · LUFS 对齐 · MIX 版本 · 音乐音效分轨 · 融合 · 不打架 · 不能盖住 适用场景 :游戏音频集成、影视短视频配乐、播客后期