mail139

Read, send, delete, reply, and forward email via IMAP/SMTP. Check for new/unread messages, fetch content, search mailboxes, mark as read/unread, and send emails with attachments. Works with any IMAP/SMTP server including Gmail, Outlook, 163.com, vip.163.com, etc.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "mail139" with this command: npx skills add cshen/skills/cshen-skills-mail139

mail139 — 139.com Email Downloader 📬

Download and search emails from 139.com via IMAP using pure Python stdlib. No pip installs needed.

Prerequisites

  • MAIL139_ID — 139.com email address (e.g. you@139.com)
  • MAIL139_TOKEN — account password/token (fallbacks: prompt or MAIL139_PASSWORD)
  • If either is missing, stop and tell the user to set them:
    export MAIL139_ID="you@139.com"
    export MAIL139_TOKEN="your-password"
    
  • IMAP access must be enabled in the 139.com account settings (设置 → POP3/SMTP/IMAP)

Tool Location

The CLI script is bundled with this skill:

{baseDir}/mail139.py

All commands follow the pattern:

python3 {baseDir}/mail139.py -u "$MAIL139_ID" -p "$MAIL139_TOKEN" <command> [options]
# or simply rely on env defaults:
MAIL139_ID=you@139.com MAIL139_TOKEN=secret python3 {baseDir}/mail139.py <command> [options]

When to Use This Skill

Activate when the user wants to:

  • Read, check, or view emails from their 139.com inbox
  • Download or save emails to disk
  • Search emails by keyword or date
  • List mailbox folders on 139.com
  • Export emails as JSON or .eml files
  • Save email attachments from 139.com
  • Delete an email from their 139.com account
  • Reply to an email on 139.com
  • Forward an email to another address from 139.com

Trigger phrases: "check my 139 email", "read my 139.com inbox", "download emails from 139", "search my 139 mail", "list my 139 folders", "save emails from 139.com", "delete email", "reply to email", "forward email", "139邮箱", "中国移动邮箱", "check inbox"

Commands Reference

List Folders

python3 {baseDir}/mail139.py -u "$MAIL139_ID" -p "$MAIL139_TOKEN" list-folders

Lists all IMAP mailboxes/folders on the account. Run this first if the user wants to fetch from a non-INBOX folder and you don't know the exact folder name. Folder names are decoded from IMAP modified UTF-7 (handles Chinese names); copy the exact output when passing --folder.

Fetch Emails

python3 {baseDir}/mail139.py -u "$MAIL139_ID" -p "$MAIL139_TOKEN" fetch [options]
OptionDefaultDescription
--folder <name>INBOXIMAP folder to fetch from
--limit <N>10Max emails to fetch (newest first)
--since <DD-Mon-YYYY>Only emails on or after this date
--search <text>Filter by text in headers or body
--format <fmt>textOutput format: text, json, or eml
--output <dir> / -o <dir>Directory to save output files
--save-attachmentsoffSave attachments (defaults to ~/Downloads if --output is omitted)
--mark-readoffMark fetched emails as read on the server

For --format eml, files are written to --output. If --output is omitted, the existing ~/Downloads directory is used. If ~/Downloads does not exist, the command exits with an error.

HTML bodies are converted to plain text via html2text (if installed), else lynx --dump, else an internal stripper. No HTML tags appear in printed/JSON bodies.

Examples:

# Print latest 10 emails to console
python3 {baseDir}/mail139.py -u "$MAIL139_ID" -p "$MAIL139_TOKEN" fetch

# Fetch last 20 emails as JSON
python3 {baseDir}/mail139.py -u "$MAIL139_ID" -p "$MAIL139_TOKEN" fetch \
  --limit 20 --format json

# Save as JSON to a directory
python3 {baseDir}/mail139.py -u "$MAIL139_ID" -p "$MAIL139_TOKEN" fetch \
  --format json -o ./emails

# Save raw .eml files and extract attachments
python3 {baseDir}/mail139.py -u "$MAIL139_ID" -p "$MAIL139_TOKEN" fetch \
  --format eml --save-attachments -o ./emails

# Fetch from Sent folder since a date
python3 {baseDir}/mail139.py -u "$MAIL139_ID" -p "$MAIL139_TOKEN" fetch \
  --folder "Sent Messages" --since "01-Jan-2025" --limit 50

# Search for emails containing a keyword
python3 {baseDir}/mail139.py -u "$MAIL139_ID" -p "$MAIL139_TOKEN" fetch \
  --search "invoice" --format json

Delete an Email

python3 {baseDir}/mail139.py -u "$MAIL139_ID" -p "$MAIL139_TOKEN" delete --uid <uid> [--folder INBOX] [--expunge]
OptionDefaultDescription
--uid <uid>requiredUID of the email to delete
--folder <name>INBOXIMAP folder containing the email
--expungeoffPermanently remove immediately; without this, only sets \Deleted flag

Without --expunge, the message is flagged for deletion but not yet removed. Pass --expunge only if the user explicitly asks to permanently delete.

# Flag for deletion (soft delete)
python3 {baseDir}/mail139.py -u "$MAIL139_ID" -p "$MAIL139_TOKEN" delete --uid 42

# Permanently delete
python3 {baseDir}/mail139.py -u "$MAIL139_ID" -p "$MAIL139_TOKEN" delete --uid 42 --expunge

# Delete from a specific folder
python3 {baseDir}/mail139.py -u "$MAIL139_ID" -p "$MAIL139_TOKEN" delete --uid 17 --folder "Sent Messages" --expunge

Reply to an Email

python3 {baseDir}/mail139.py -u "$MAIL139_ID" -p "$MAIL139_TOKEN" reply --uid <uid> --body "text" [--folder INBOX] [--reply-all]
OptionDefaultDescription
--uid <uid>requiredUID of the email to reply to
--body <text>requiredReply body. Use "-" to read from stdin
--folder <name>INBOXIMAP folder containing the original email
--reply-alloffReply to all recipients (To + Cc), not just the sender
# Simple reply
python3 {baseDir}/mail139.py -u "$MAIL139_ID" -p "$MAIL139_TOKEN" reply --uid 42 --body "Thanks, got it!"

# Reply-all
python3 {baseDir}/mail139.py -u "$MAIL139_ID" -p "$MAIL139_TOKEN" reply --uid 42 --body "See below." --reply-all

# Multi-line body from stdin
echo -e "Hi,\n\nPlease see my response." | python3 {baseDir}/mail139.py -u "$MAIL139_ID" -p "$MAIL139_TOKEN" reply --uid 42 --body -

Forward an Email

python3 {baseDir}/mail139.py -u "$MAIL139_ID" -p "$MAIL139_TOKEN" forward --uid <uid> --to recipient@example.com [--folder INBOX] [--body "note"]
OptionDefaultDescription
--uid <uid>requiredUID of the email to forward
--to <email>requiredRecipient email address
--folder <name>INBOXIMAP folder containing the original email
--body <text>Optional message prepended before the forwarded content
# Forward with no preamble
python3 {baseDir}/mail139.py -u "$MAIL139_ID" -p "$MAIL139_TOKEN" forward --uid 42 --to colleague@example.com

# Forward with a note
python3 {baseDir}/mail139.py -u "$MAIL139_ID" -p "$MAIL139_TOKEN" forward --uid 42 --to boss@example.com --body "FYI — see below."

Output Format Details

text

Prints each email to stdout with a header block (UID, Date, From, To, Subject, Attachments) and up to 2 000 characters of body text. Ideal for quick reading.

json

Produces an array of objects. Each object has:

{
  "uid": "1234",
  "date": "Mon, 10 Mar 2025 09:00:00 +0800",
  "from": "sender@example.com",
  "to": "you@139.com",
  "subject": "Hello",
  "content_type": "text/plain",
  "body": "Email body text…",
  "attachments": ["report.pdf"]
}

Written to emails.json inside --output, or printed to stdout if no --output is given.

eml

Saves each email as <uid>.eml — a raw RFC 822 file openable in any email client. Requires --output.

Important Details

Date Format for --since

Use IMAP date format: DD-Mon-YYYY — e.g. 01-Jan-2025, 15-Mar-2026.

Folder Names

139.com folder names may be in Chinese. Always run list-folders first if unsure. Common folders:

  • INBOX — inbox (always English)
  • Sent Messages — sent mail
  • Drafts — drafts
  • Deleted Messages — trash

Attachment Saving

Attachments are saved to <output>/<uid>_attachments/<filename>. If --output is not set, attachments default to ~/Downloads/<uid>_attachments/. The --save-attachments flag works independently of --output. By default attachments are saved to ~/Downloads if --output is not specified.

Read-Only by Default

Without --mark-read, the script opens the mailbox read-only and leaves no server-side trace. Pass --mark-read only if the user explicitly asks to mark emails as read.

Behavioral Rules

  1. Always use python3 to invoke the script.
  2. Prefer env vars for credentials ($MAIL139_ID, $MAIL139_TOKEN fallback $MAIL139_PASSWORD) — never echo passwords in plain text in explanations.
  3. If MAIL139_ID or MAIL139_TOKEN are not set, stop and ask the user to export them before proceeding (or be ready to prompt for password).
  4. Default to --format text for casual "check my email" requests; use json when the user wants to process or save data; use eml when they want to archive or open in an email client.
  5. When the user asks to search, use --search for keyword filters and --since for date filters; combine both when appropriate.
  6. When the user asks for a specific folder, run list-folders first if you are unsure of the exact folder name.
  7. Do not use --mark-read unless the user explicitly asks to mark emails as read.
  8. After fetching JSON, parse and summarise the results for the user — don't just dump the raw JSON unless asked.
  9. If a command fails, read stderr and explain the issue in plain language (e.g. wrong password, IMAP not enabled, network error).
  10. For attachment tasks, --save-attachments works without --output — attachments will be saved to ~/Downloads/<uid>_attachments/ by default. Only set --output if the user wants a specific location.
  11. For delete, default to soft-delete (flag only, no --expunge). Only pass --expunge when the user explicitly says "permanently delete" or "remove completely".
  12. For reply, use --reply-all only when the user explicitly asks to reply to everyone. Default to replying only to the sender.
  13. For reply and forward, both IMAP (to fetch the original) and SMTP (to send) connections are established. The same credentials are used for both.
  14. For multi-line reply bodies, suggest using stdin (--body -) with a heredoc or echo pipe rather than embedding newlines in a shell argument.

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

dida365

No summary provided by upstream source.

Repository SourceNeeds Review
General

nano-banana-2

Nano Banana 2 - Gemini 3.1 Flash Image Preview

Repository Source
43.3K153inferen-sh
General

qwen-image-2

Qwen-Image - Alibaba Image Generation

Repository Source
43.1K153inferen-sh
General

p-video

Pruna P-Video Generation

Repository Source
43.1K153inferen-sh