验证 SMTP
POST
/web/v1/notification/email/validate/smtpWEB通过尝试连接和认证来验证 SMTP 邮件服务器配置。
鉴权
需要有效的 JWT token 和 Turnstile 验证。网关校验:enableJwtToken=true,enableTurnstile=true。
请求参数
查询参数
| Name | Type | Required | In | Description |
|---|---|---|---|---|
requestId | string | Yes | query | 用于幂等性/追踪的唯一请求 ID |
请求体
EmailValidationRequest:
| Name | Type | Required | In | Description |
|---|---|---|---|---|
channelHost | string | Yes | body | 通知渠道主机/访问端点 |
config | object | Yes | body | 要验证的邮箱渠道配置 |
config.smtpHost | string | Yes | body | SMTP 服务器主机名 |
config.smtpPort | integer | Yes | body | SMTP 服务器端口(1-65535) |
config.senderEmail | string | Yes | body | 发件人邮箱地址 |
config.senderName | string | Yes | body | 发件人显示名称 |
config.username | string | Yes | body | SMTP 认证用户名 |
config.password | string | Yes | body | SMTP 认证密码 |
config.useSsl | boolean | No | body | 是否使用 SSL(默认值:true) |
config.useStartTls | boolean | No | body | 是否使用 STARTTLS(默认值:false) |
config.connectionTimeout | integer | No | body | 连接超时时间(毫秒,默认值:10000) |
config.readTimeout | integer | No | body | 读取超时时间(毫秒,默认值:30000) |
成功响应
成功200
{
"code": "2000",
"message": "SUCCESS",
"data": {
"valid": true,
"results": {
"SMTP": {
"success": true,
"serverHost": "smtp.example.com",
"serverPort": 587,
"connectionTimeMs": 245,
"errorCode": null,
"errorMessage": null
}
}
}
}错误响应
| 错误码 | 描述 |
|---|---|
4000 | 校验错误(缺少必填配置字段) |
4010 | 未授权(无效或缺少 JWT token) |
4030 | Turnstile 验证失败 |
说明
- 此接口仅测试 SMTP 连接。如需测试 IMAP 连接,请使用 IMAP 验证接口。
requestId查询参数可用于幂等性和请求追踪。- 验证成功不会创建或修改任何渠道。