发送邮件
接口说明
直接发送邮件,无需使用模板。支持批量发送给多个收件人,所有收件人将收到相同内容的邮件。
请求信息
- 获取公私钥:
ACCESSKEY_ID:ACCESSKEY_SECRET - 请求方法:
POST - 请求路径:
/api/v1/email/SendEmail - Content-Type:
application/json
请求参数
| 参数名 | 类型 | 必填 | 说明 | 示例值 |
|---|---|---|---|---|
| SendEmail | string | 是 | 发件人邮箱地址 | "sender@example.com" |
| TargetEmailAddress | array | 是 | 收件人邮箱地址列表,最少1个,最多100个 | ["recipient1@example.com", "recipient2@example.com"] |
| Subject | string | 是 | 邮件主题,长度1-200字符 | "欢迎使用USpeedo邮件服务" |
| Content | string | 是 | 邮件内容,最少1个字符 | "邮件内容" |
| FromName | string | 否 | 发件人昵称 | "USpeedo" |
注意事项
TargetEmailAddress数组长度限制为1-100个邮箱地址Subject长度限制为1-200个字符Content最少需要1个字符,支持HTML格式
请求示例
curl -X POST "https://api.uspeedo.com/api/v1/email/SendEmail" \
-H "Content-Type: application/json" \
-H "Authorization: Basic $(echo -n 'ACCESSKEY_ID:ACCESSKEY_SECRET' | base64)" \
-d '{
"SendEmail": "sender@example.com",
"TargetEmailAddress": [
"recipient1@example.com",
"recipient2@example.com"
],
"Subject": "欢迎使用USpeedo邮件服务",
"Content": "<html><body><h1>欢迎</h1><p>这是一封测试邮件。</p></body></html>",
"FromName": "USpeedo"
}'
响应格式
成功响应
{
"RetCode": 0,
"Message": "success",
"SessionNo": "session_1234567890",
"FailedTargetEmails": []
}
响应字段说明
| 字段名 | 类型 | 说明 |
|---|---|---|
| RetCode | int | 返回码,0表示成功 |
| Message | string | 返回消息 |
| SessionNo | string | 会话编号,用于查询发送状态 |
| FailedTargetEmails | array | 发送失败的收件人列表,每个元素包含:EmailAddress(邮箱地址)、FailureReason(失败原因) |
失败响应
{
"RetCode": 215392,
"Message": "Invalid parameter [SendEmail]"
}
常见错误码
| 错误码 | 说明 |
|---|---|
| 0 | 成功 |
| 215392 | 参数错误 |
| 215397 | 缺少必填参数 |
| 215400 | 服务器错误 |