内置邮箱查询
积木账号专属 @jimu.chat 邮箱的查询、自助申请与应用专用密码管理接口。
积木为每个账号分配一个 @jimu.chat 专属邮箱(mailcow 承载),用于社区登录、
邮件收发与需要邮箱的第三方集成。四个接口均属于管理接口,
鉴权方式为登录会话(或用户 access token)+ Jimu-Api-User 请求头,
见 鉴权与令牌——不接受 sk- API 令牌。
| 方法 | 路径 | 说明 |
|---|---|---|
GET | /api/user/mailbox | 查询本人邮箱地址与密码 |
POST | /api/user/mailbox/apply | 自助申请邮箱(支持自定义邮箱名) |
GET | /api/user/mailbox/app-password | 查询应用专用密码(含一致性校验) |
POST | /api/user/mailbox/app-password | 重新生成应用专用密码(旧的即刻失效) |
两个 POST 接口受严格速率限制,失败响应为 {"success": false, "message": "..."}(HTTP 可能仍为 200)。
查询邮箱
/api/user/mailbox返回本人邮箱信息,无需参数:
{
"success": true,
"data": {
"has_mailbox": true,
"email": "zhangsan@jimu.chat",
"password": "xK9mP2vQ7nL4wR8tY3sA",
"password_source": "mailbox",
"message": "这是您的专属邮箱密码,可用于登录 webmail"
}
}
has_mailboxbool是否已分配邮箱;为 false 时 email 为空串
emailstring邮箱地址
passwordstring邮箱密码(明文返回,请走 HTTPS 并妥善保管)
password_sourcestringmailbox = 独立邮箱密码(当前策略);account = 存量老账号,密码与积木账号密码一致,此时 password 为空串不回显
password_source=mailbox 时),
修改账号密码不会影响邮箱登录。webmail 地址为 https://mail.jimu.chat。申请邮箱
/api/user/mailbox/apply前置条件:账号必须先绑定手机号或微信(二选一),否则返回
{"success": false, "message": "请先绑定手机号或微信后才能申请邮箱"}。
请求体(全部可选):
local_partstring自定义邮箱名(@ 前的部分)。3–30 字符,仅限小写字母、数字、点、下划线、短横线,且不能以点或短横线开头/结尾。不传则按用户名自动生成
接口幂等:已分配邮箱时直接返回现有邮箱,不重复创建:
{
"success": true,
"message": "您已有专属邮箱",
"data": { "email": "zhangsan@jimu.chat" }
}
应用专用密码
应用专用密码(app password)是独立于邮箱主密码的第二套凭证,用于第三方邮件客户端 (Outlook、Apple Mail、Thunderbird 等)通过 IMAP/SMTP/POP3 登录。 相比直接用主密码,它的优势是可单独吊销、不影响 webmail 登录——客户端丢失或不再使用时, 重新生成一次即可让旧凭证全部失效。
查询应用密码
/api/user/mailbox/app-password{
"success": true,
"data": {
"has_app_password": true,
"email": "zhangsan@jimu.chat",
"app_password": "aB3dE5fG7hJ9kL1mN3pQ",
"imap_host": "mail.jimu.chat",
"imap_port": 993,
"smtp_host": "mail.jimu.chat",
"smtp_port": 465,
"protocols": ["imap", "smtp", "pop3"],
"consistent": true,
"message": "这是您已生成的邮箱应用密码"
}
}
has_app_passwordbool是否已生成过;为 false 时先调 POST 生成
app_passwordstring应用密码明文
consistentbool本地记录与邮箱服务侧是否一致。false 表示密码已在邮箱服务侧被删除,需重新生成
imap_host / imap_portstring / intIMAP 连接参数(993,SSL)
smtp_host / smtp_portstring / intSMTP 连接参数(465,SSL)
protocolsstring[]该密码放行的协议
重新生成应用密码
/api/user/mailbox/app-password无请求体。每次调用都会删除旧应用密码再生成新的,旧密码即刻失效——
所有使用旧密码的客户端会立即无法收发邮件,需用新密码重新配置。
响应结构与 GET 一致(consistent 恒为 true)。
# 查询
curl https://api.jimu.chat/api/user/mailbox/app-password \
-H "Cookie: session=..." -H "Jimu-Api-User: 1001"
# 重新生成(旧密码即刻失效)
curl -X POST https://api.jimu.chat/api/user/mailbox/app-password \
-H "Cookie: session=..." -H "Jimu-Api-User: 1001"