名称: fastmail
描述: 通过 JMAP 和 CalDAV API 管理 Fastmail 电子邮件与日历。可用于邮件(读取、发送、回复、搜索、整理、批量操作、会话线程)或日历(事件、提醒、邀请回复)。时区自动从系统检测。
compatibility: opencode
元数据:
author: witooh
version: "2.1"
api: JMAP, CalDAV
通过命令行调用工具:
# 首先安装依赖
cd .opencode/skills/fastmail && bun install
# 邮件:列出邮箱文件夹
bunx fastmail list_mailboxes
# 邮件:发送
bunx fastmail send_email \
'{"to": [{"email": "user@example.com"}], "subject": "你好", "text_body": "消息内容"}'
# 日历:列出事件
bunx fastmail list_events \
'{"start_date": "2024-01-01", "end_date": "2024-01-31"}'
# 日历:创建带提醒的事件
bunx fastmail create_event_with_reminder \
'{"title": "会议", "start": "2024-01-15T10:00:00", "end": "2024-01-15T11:00:00", "reminder_minutes": [15, 60]}'
# 列出所有可用工具
bunx fastmail --list
| 工具 | 用途 |
|---|---|
list_mailboxes |
列出所有文件夹 |
list_emails |
列出邮箱中的邮件 |
get_email |
获取完整邮件内容 |
get_thread |
获取会话线程中的所有邮件 |
search_emails |
按文本查询搜索 |
send_email |
发送新邮件 |
reply_email |
回复邮件 |
move_email |
移动到文件夹 |
set_labels |
应用标签($seen, $flagged) |
delete_email |
删除(移至垃圾箱) |
| 工具 | 用途 |
|---|---|
bulk_move_emails |
批量移动多个邮件 |
bulk_set_labels |
为多个邮件应用标签 |
bulk_delete_emails |
批量删除多个邮件 |
| 工具 | 用途 |
|---|---|
list_calendars |
列出所有日历 |
list_events |
按日期范围列出事件 |
get_event |
获取事件详情 |
create_event |
创建新事件 |
update_event |
更新现有事件 |
delete_event |
删除事件 |
search_events |
按标题/描述搜索 |
create_recurring_event |
创建重复事件 |
list_invitations |
列出日历邀请 |
respond_to_invitation |
接受/拒绝/暂定邀请 |
| 工具 | 用途 |
|---|---|
add_event_reminder |
为事件添加提醒 |
remove_event_reminder |
移除事件提醒 |
list_event_reminders |
列出事件的所有提醒 |
create_event_with_reminder |
一键创建事件及提醒 |
# 查看收件箱(限制 10 条)
bunx fastmail list_emails '{"limit": 10}'
# 搜索邮件
bunx fastmail search_emails '{"query": "发票"}'
# 获取特定邮件内容
bunx fastmail get_email '{"email_id": "xxx"}'
# 获取邮件会话线程
bunx fastmail get_thread '{"email_id": "xxx"}'
# 批量操作
bunx fastmail bulk_move_emails '{"email_ids": ["id1", "id2"], "target_mailbox_id": "archive"}'
bunx fastmail bulk_delete_emails '{"email_ids": ["id1", "id2", "id3"]}'
# 创建重复事件(每日,持续 10 天)
bunx fastmail create_recurring_event \
'{"title": "站会", "start": "2024-01-01T09:00:00", "end": "2024-01-01T09:30:00", "recurrence": "daily", "recurrence_count": 10}'
# 日历邀请
bunx fastmail list_invitations
bunx fastmail respond_to_invitation '{"event_id": "xxx", "response": "accept"}'
需要管理邮件?
- 列出/搜索 → list_emails 或 search_emails
- 阅读内容 → get_email
- 查看会话 → get_thread
- 发送/回复 → send_email 或 reply_email
- 整理 → move_email, set_labels, delete_email
- 批量操作 → bulk_move_emails, bulk_set_labels, bulk_delete_emails
需要管理日历?
- 查看 → list_calendars 或 list_events
- 创建 → create_event 或 create_recurring_event
- 修改 → update_event
- 删除 → delete_event
- 邀请 → list_invitations, respond_to_invitation
需要设置提醒?
- 为现有事件添加 → add_event_reminder
- 创建事件及提醒 → create_event_with_reminder(更快捷)
- 管理 → list_event_reminders, remove_event_reminder
所有工具均返回 JSON:
{
"success": true,
"data": { /* 工具特定响应 */ },
"timestamp": "2024-01-15T10:00:00+07:00"
}
| 变量 | 用途 | 必需 |
|---|---|---|
FASTMAIL_API_TOKEN |
通过 JMAP 管理邮件 | 是(用于邮件) |
FASTMAIL_USERNAME |
通过 CalDAV 管理日历 | 是(用于日历) |
FASTMAIL_PASSWORD |
日历应用密码 | 是(用于日历) |
FASTMAIL_TIMEZONE |
日历时区(IANA 格式) | 否(自动检测) |
设置示例:
export FASTMAIL_API_TOKEN="你的API令牌"
export FASTMAIL_USERNAME="你的邮箱@fastmail.com"
export FASTMAIL_PASSWORD="你的应用密码"
# 可选:覆盖时区(默认使用系统本地时区)
export FASTMAIL_TIMEZONE="America/New_York" # 或 "Asia/Bangkok", "Europe/London" 等
⏰ 可配置的日历时区
- 默认: 自动检测系统本地时区
- 覆盖: 设置 FASTMAIL_TIMEZONE 环境变量
- 使用 IANA 时区标识符(如 America/New_York, Asia/Bangkok, Europe/London)
- 输入时间假定为配置的时区
- 输出时间以配置的时区显示
- 内部以 UTC 存储
- 自动处理夏令时(DST)
.opencode/skills/fastmail/references/TOOLS.md.opencode/skills/fastmail/README.md