SuperAPI AI Directory

email

Office & productivity

View repository

Updated 10-16 00:02

About this skill

email

Wraps the email command-line tool for email sending and receiving management.

Core Capabilities

  1. Receive Emails - List emails, filter unread, filter by conditions
  2. Send Emails - Send text/HTML emails, send with attachments
  3. Account Management - Configure multiple email accounts, set the default account
  4. Folder Management - List email folders

Workflow

📬 Receive Emails

When the user asks to view emails, check for new emails, or receive emails:

# 列出最近 10 封邮件(不获取正文,保持未读状态)
email receive --account <账户名>

# 查看未读邮件
email receive --account <账户名> --unseen --max 20

# 获取邮件正文并标记已读
email receive --account <账户名> --body

# 以 Markdown 格式输出正文
email receive --account <账户名> --format markdown

# 下载附件
email receive --account <账户名> --attachments ./downloads

# 按条件筛选
email receive --account <账户名> --from sender@example.com --since 2024-01-01

# JSON 格式输出
email receive --account <账户名> --format json

📧 Send Emails

When the user asks to send emails or forward emails:

# 简单发送
email send --account <账户名> --to recipient@example.com --subject "Hello" --body "Hi there!"

# 带附件发送
email send --account <账户名> --to recipient@example.com \
  --subject "Report" \
  --body "Please find attached." \
  --attach ./report.pdf

# HTML 邮件
email send --account <账户名> --to recipient@example.com \
  --subject "Newsletter" \
  --html "<h1>Hello</h1><p>Content here</p>"

# 抄送/密送
email send --account <账户名> \
  --to recipient@example.com \
  --cc boss@company.com \
  --subject "Update" \
  --body "Status update"

# 预览模式(不实际发送)
email send --account <账户名> --to recipient@example.com \
  --subject "Test" --body "Test" --dry-run

⚙️ Configure Email Accounts

When the user uses it for the first time or needs to add an email account:

# 交互式配置
email config

# 命令行配置
email config --name work \
  --user me@company.com \
  --password "app-password" \
  --save-dir "~/Library/Application Support/email-cli/emails/work" \
  --imap-host imap.company.com \
  --imap-port 993 \
  --smtp-host smtp.company.com \
  --smtp-port 587

🛠️ Troubleshooting

If execution fails, troubleshoot according to the following steps:

1. 检查安装 → 2. 检查账户配置 → 3. 检查网络连接

Step 1: Check whether @lyhue1991/email-cli

command -v email

If not installed, run:

npm install -g @lyhue1991/email-cli

Step 2: Check account configuration

email config --list

If there is no account, guide the user to configure one:

email config

View account details:

email config --show <账户名>

The account configuration will display the default saveDir; when receiving emails, if --saveis not passed, this directory will be used automatically.

Step 3: Check network connection

If the connection times out, it may be a network issue or an incorrect server address.

📁 List Folders

email folders --account <账户名>

👤 Account Management

# 列出所有账户
email list
email config --list

# 设置默认账户
email config --default <账户名>

# 删除账户
email config --remove <账户名>

Common Provider Configurations

Provider IMAP SMTP
Gmail imap.gmail.com:993 smtp.gmail.com:587
Outlook outlook.office365.com:993 smtp.office365.com:587
QQ Mail imap.qq.com:993 smtp.qq.com:587
163 imap.163.com:993 smtp.163.com:465
126 imap.126.com:993 smtp.126.com:465
139 imap.139.com:993 smtp.139.com:465

Parameter Description

receive Command

Parameter Description
--folder <name> Folder name, default INBOX
--unseen Receive only unread emails
--seen Receive only read emails
--max <count> Maximum quantity, default 10
--from <email> Filter by sender
--subject <pattern> Filter by subject
--since <date> Filter by date (YYYY-MM-DD)
--body Get the email body (will mark as read;--format markdown automatically enabled when)
--attachments <dir> Download attachments to the specified directory (automatically gets the body and marks as read)
--format <format> Output format: table, json, markdown

send Command

Parameter Description
--to <emails> Recipients (comma-separated)
--cc <emails> CC (comma-separated)
--bcc <emails> BCC (comma-separated)
--subject <subject> Email subject
--body <text> Plain text body
--html <html> HTML body
--attach <files> Attachment path
--dry-run Preview mode

Notes

  1. Receiving emails does not change status - By default, only envelope information is retrieved and emails are not marked as read; use --body or --format markdown to mark as read
  2. Password Security - The configuration file stores passwords in plaintext; be sure to protect the configuration file
  3. App-Specific Passwords - Email services such as Gmail and QQ require an app-specific password/authorization code
  4. TLS Certificate - Some email accounts may require ignoring certificate verification

Quick Reference

# 查看帮助
email --help
email receive --help
email send --help

# 配置账户
email config
email config --list

# 收取邮件
email receive                          # 列出最近邮件
email receive --unseen --max 20        # 查看未读
email receive --body                   # 获取正文
email receive --format markdown        # Markdown 输出
email receive --attachments ./downloads         # 下载附件

# 发送邮件
email send --to user@example.com --subject "Hello" --body "Hi!"
email send --to user@example.com --subject "Report" --attach ./report.pdf

# 列出文件夹
email folders

# 账户管理
email list
email config --default work
email config --remove old-account