返回面板

Bulk Mail Hub - API 文档 (V1)

基础信息

基础 URL: http://93.127.139.192:45679/api/v1

认证方式: 在每个请求的 HTTP 请求头 (Header) 中添加 Authorization: Bearer YOUR_API_KEY。API Key 请登录您的 Bulk Mail Hub 账户在 "API 设置" 页面获取。

域名管理 (Domains)

查询所有域名

GET /domains

描述: 获取当前用户账户下所有已添加的域名列表。

响应 (成功 - 200 OK):

[
  {"name": "domain1.com"},
  {"name": "domain2.net"}
]

响应 (失败): 401 Unauthorized (Key 无效), 500 Internal Server Error

批量导入域名

POST /domains

描述: 将一个或多个域名批量添加到当前用户的账户下。

请求体 (JSON):

{
  "domains": ["newdomain1.com", "newdomain2.org"] 
}

响应 (成功 - 200 OK): 返回每条记录的处理结果。

[
  {"domain": "newdomain1.com", "status": "success"},
  {"domain": "newdomain2.org", "status": "skipped", "details": "Domain already exists for this user."},
  {"domain": "faileddomain.com", "status": "failed", "details": {"error": "API request failed", "details": "..."}} 
]

响应 (失败): 400 Bad Request (缺少 `domains` 字段或格式错误), 401 Unauthorized, 500 Internal Server Error

邮箱管理 (Emails)

查询所有邮箱

GET /emails

描述: 获取当前用户账户下所有域名的邮箱列表。

响应 (成功 - 200 OK):

[
  {"id": 1, "email": "user1@domain1.com"},
  {"id": 2, "email": "support@domain2.net"}
]

响应 (失败): 401 Unauthorized, 500 Internal Server Error

批量随机生成邮箱

POST /emails/generate-random

描述: 在用户指定的一个或多个域名下,批量生成指定数量的随机前缀邮箱。

请求体 (JSON):

{
  "domains": ["domain1.com", "domain2.net"],
  "count": 5
}

响应 (成功 - 200 OK): 返回每个生成操作的结果,包含邮箱地址和密码(如果成功)。

[
  {"email": "abc123de@domain1.com", "password": "GeneratedPassword1", "status": "success", "details": {}},
  {"email": "xyz789fg@domain2.net", "password": "GeneratedPassword2", "status": "success", "details": {}},
  {"email": "failed@domain1.com", "password": null, "status": "failed", "details": {"error": "..."}}
]

响应 (失败): 400 Bad Request (参数缺失或无效), 401 Unauthorized, 403 Forbidden (用户不拥有指定域名), 500 Internal Server Error

指定前缀生成邮箱

POST /emails/generate-specific

描述: 在用户指定的单个域名下,为提供的一系列前缀生成邮箱。

请求体 (JSON):

{
  "domain": "domain1.com",
  "prefixes": ["admin", "support", "sales"]
}

响应 (成功 - 200 OK): 返回每个生成操作的结果。

[
  {"email": "admin@domain1.com", "password": "GeneratedPassword3", "status": "success", "details": {}},
  {"email": "support@domain1.com", "password": "GeneratedPassword4", "status": "success", "details": {}},
  {"email": "sales@domain1.com", "password": null, "status": "failed", "details": {"error": "Account already exists."}}
]

响应 (失败): 400 Bad Request, 401 Unauthorized, 403 Forbidden, 500 Internal Server Error

批量收信 (Inbox)

批量收信与提取

POST /inbox/fetch

描述: 登录用户提供的多个邮箱账户,根据指定类型提取信息(最新邮件、验证码、链接或关键词搜索)。

请求体 (JSON):

{
  "accounts": [
    {"email": "user1@domain.com", "password": "password123"},
    {"email": "user2@domain.com", "password": "password456"}
  ],
  "extract_type": "code", 
  "keyword": null 
}

响应 (成功 - 200 OK): 返回一个包含所有处理结果的数组。

[
  {"from": "...", "to": "user1@domain.com", "subject": "...", "body_preview": "...", "extracted_content": "123456"},
  {"from": "...", "to": "user2@domain.com", "subject": "包含<mark>关键词</mark>的主题", "body_preview": "...", "extracted_content": ""},
  {"error": "Failed to process user3@domain.com: Authentication failed"}
]

响应 (失败): 400 Bad Request (参数错误), 401 Unauthorized, 500 Internal Server Error

批量发信 (Sending)

提交批量发送任务

POST /emails/send-bulk

描述: 提交一个后台异步的批量发送任务。

请求体 (JSON):

{
  "senders": "sender1@your-domain.com\nsender2@your-domain.com",
  "recipients": "email,name\nuser1@example.com,Alice\nuser2@example.com,Bob",
  "subject": "你好 {name}",
  "body": "<p>这是邮件内容, {name}。</p>",
  "interval": 5
}

响应 (成功 - 202 Accepted): 表示任务已提交到后台。

{
  "message": "任务已成功提交!系统将在后台处理 2 个收件人。" 
}

响应 (失败): 400 Bad Request, 401 Unauthorized, 500 Internal Server Error

注意: 这是一个异步操作。API 仅返回提交结果,不代表邮件已发送完成。