Skip to content
Back to skills

Feishu Mail

ASecurity

飞书企业邮箱管理与收发。当用户说"发邮件"、"收邮件"、"查邮件"、"回复邮件"、"send email"、"check email"、"加个邮箱"、"配置邮箱"、"create mailbox"、"setup email"等关键词时触发。

  • 5 stars
  • 0 votes
  • 0 copies
  • 5 views
  • Added September 13, 2026
ai-agentspythonbashgcpapidatabase

Works with

  • api

Security analysis

A100/100

Pro scans all 5 files and shows the line behind each finding

Scanned September 13, 2026

npx -y skills add yangwhale/CloseCrab --skill feishu-mail --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Feishu Mail?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Feishu Mail
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/yangwhale-feishu-mail/badge)](https://www.skillsdirectory.com/skills/yangwhale-feishu-mail)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: feishu-mail
description: 飞书企业邮箱管理与收发。当用户说"发邮件"、"收邮件"、"查邮件"、"回复邮件"、"send email"、"check email"、"加个邮箱"、"配置邮箱"、"create mailbox"、"setup email"等关键词时触发。
license: MIT
---

# 飞书企业邮箱(SMTP + IMAP)

每个 bot 有独立企业邮箱,SMTP 发信 + IMAP 收信,无需 OAuth。From 显示名自动取邮箱前缀。邮箱配置存储在 Firestore `bots/{bot_name}` 的 `email` 字段。

## 触发条件

- "发邮件"、"发 email"、"send email"、"邮件通知"
- "查邮件"、"收邮件"、"check email"、"看看邮箱"
- "回复邮件"、"reply email"

## 发送邮件

```bash
python3 ~/.claude/skills/feishu-mail/send_mail.py \
  --to "收件人@example.com" \
  --subject "标题" \
  --body "正文内容"
```

**参数:**
- `--to`: 收件人(必填,多个逗号分隔)
- `--subject`: 标题(必填)
- `--body`: 正文(必填)
- `--cc`: 抄送(可选)
- `--html`: 正文为 HTML 格式

**示例:**
```bash
# 纯文本
python3 ~/.claude/skills/feishu-mail/send_mail.py \
  --to "user@example.com" --subject "通知" --body "任务完成"

# HTML 邮件
python3 ~/.claude/skills/feishu-mail/send_mail.py \
  --to "user@example.com" --subject "报告" --html \
  --body "<h2>标题</h2><p>详情...</p>"
```

## 查收邮件

```bash
python3 ~/.claude/skills/feishu-mail/recv_mail.py [选项]
```

**参数:**
- `--limit N`: 最多显示 N 封(默认 10)
- `--unread`: 只看未读
- `--from "xxx"`: 按发件人过滤
- `--subject "xxx"`: 按主题过滤
- `--json`: JSON 格式输出(适合程序处理)
- `--folder "INBOX"`: 文件夹(默认 INBOX)

**示例:**
```bash
# 查看最近 5 封
python3 ~/.claude/skills/feishu-mail/recv_mail.py --limit 5

# 只看未读
python3 ~/.claude/skills/feishu-mail/recv_mail.py --unread

# 按发件人过滤
python3 ~/.claude/skills/feishu-mail/recv_mail.py --from "sender@example.com"

# JSON 输出
python3 ~/.claude/skills/feishu-mail/recv_mail.py --json --limit 3
```

## 回复邮件

```bash
python3 ~/.claude/skills/feishu-mail/reply_mail.py \
  --id "邮件ID" \
  --body "回复内容"
```

**参数:**
- `--id`: 邮件 ID(从 recv_mail.py 输出获取,必填)
- `--body`: 回复正文(必填)
- `--html`: 正文为 HTML 格式
- `--folder`: 文件夹(默认 INBOX)

**示例:**
```bash
# 先查邮件获取 ID
python3 ~/.claude/skills/feishu-mail/recv_mail.py --limit 3
# 回复 ID 为 1 的邮件
python3 ~/.claude/skills/feishu-mail/reply_mail.py --id 1 --body "收到,谢谢!"
```

## 典型工作流

```bash
# 1. 查看未读邮件
python3 ~/.claude/skills/feishu-mail/recv_mail.py --unread --json

# 2. 根据内容决定回复
python3 ~/.claude/skills/feishu-mail/reply_mail.py --id 1 --body "已处理"

# 3. 主动发新邮件
python3 ~/.claude/skills/feishu-mail/send_mail.py \
  --to "someone@example.com" --subject "结果" --body "任务完成"
```

## 配置

凭据从 Firestore `bots/{bot_name}` 的 `email` 字段读取,`main.py` 启动时自动映射到环境变量:

- `FEISHU_SMTP_HOST`: smtp.feishu.cn
- `FEISHU_SMTP_PORT`: 465 (SSL)
- `FEISHU_SMTP_USER`: bot 企业邮箱地址
- `FEISHU_SMTP_PASS`: SMTP/IMAP 专用密码(飞书管理后台生成)

多 bot 同机时,各 bot 从 Firestore 读取独立邮箱配置,`main.py` 启动时自动设置环境变量。

IMAP 使用相同凭据,服务器 `imap.feishu.cn:993` (SSL)。

## 邮箱管理(创建/删除公共邮箱)

通过 `setup_mailbox.py` 管理飞书公共邮箱,完整流程:创建邮箱 → 管理后台开启 SMTP → 配置密码到 Firestore。

### 创建公共邮箱

```bash
python3 ~/.claude/skills/feishu-mail/setup_mailbox.py create \
  --email "bot@your-domain.com" \
  --name "Bot Name"
```

创建成功后,需要手动去飞书管理后台开启 SMTP:
1. 打开 https://your-org.feishu.cn/admin/email/public_mailbox
2. 找到新建的邮箱 → 开启 IMAP/SMTP → 生成应用密码

### 配置 SMTP 密码到 Firestore

```bash
# 默认写入 FIRESTORE_DATABASE (closecrab)
python3 ~/.claude/skills/feishu-mail/setup_mailbox.py set-password \
  --bot athena \
  --password "YOUR_APP_PASSWORD"

# 指定数据库(如 closecrab-public)
python3 ~/.claude/skills/feishu-mail/setup_mailbox.py set-password \
  --bot athena \
  --password "YOUR_APP_PASSWORD" \
  --database closecrab-public

# 如果 bot 还没有 email 配置,用 --email 初始化完整配置
python3 ~/.claude/skills/feishu-mail/setup_mailbox.py set-password \
  --bot newbot \
  --password "xxx" \
  --email "newbot@your-domain.com"
```

### 列出所有公共邮箱

```bash
python3 ~/.claude/skills/feishu-mail/setup_mailbox.py list
```

### 删除公共邮箱

```bash
python3 ~/.claude/skills/feishu-mail/setup_mailbox.py delete --mailbox-id "1RNM10VNQREQPKK"
```

### 环境变量

- `MAIL_ADMIN_BOT`: 用于调飞书 API 的 bot(需有 `mail:public_mailbox` 权限,默认 `jarvis`)
- `FIRESTORE_PROJECT`: GCP 项目(默认 `your-gcp-project`)
- `FIRESTORE_DATABASE`: Firestore 数据库(默认 `closecrab`)

## 限制

- 发信频率: 200 封/100 秒
- 单日上限: 100 封/发件人

Files in this skill

  • SKILL.md5.1 KB
  • recv_mail.py5.5 KB
  • reply_mail.py4 KB
  • send_mail.py4.2 KB
  • setup_mailbox.py7.3 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.