API Reference

使用场景

接入该接口请先完成接入准备 
批量邮件发送,此接口适用【相同内容不同邮箱】的批量发送数据请求记录生命周期:1周  
 备注:邮件发送需要完成发件人和发件域的设置,另外需要保持账户充足的余额

请求url

https://sending.mambasms.com/open/api/international/email/batch/send

请求方式

POST

公共参数说明

请求头字段类型是否必填限制
X-Mamba-Access-TokenStringY接入准备过程中获取的秘钥
Content-TypeStringYapplication/json

请求参数说明

参数类型必填限制描述示例值
request_idStringY最长64个字符请求业务ID,相同值只处理一次7875160946299813889
campaign_idStringY最长64个字符活动id
campaign_nameStringN最长200个字符活动名称
from_nameStringN最长100个字符发件人名称
fromStringY发件人,需要后台配置生效的;另外对应的发件域需要后台验证通过发件人邮箱
subjectStringY最长500个字符 UTF-8不含RFC2047邮件主题
contentStringYhtml 、text
其中html不能含meta标签(自动清除meta标签)
发送邮件内容
list_remarkStringN最长500个字符收件人分组说明
emailsStringY多个英文逗号分隔,最多1000邮箱,多个邮箱英文逗号分隔,单批次不允许重复邮箱,为保障邮件发送成功率,避免特殊字符造成发送失败
totalLongYemails的个数,不一致时则会报错
reply_toStringY邮件回复地址
request_timeStringYISO-8601时间格式请求时间示例值:2023-10-27T15:18:42.223+08:00
biz_paramJSONN限制256个字符自定义业务请求参数,回调时携带,JSON格式

幂等机制:request_id,若失败检查失败原因。
发件人与发件域说明:发件人“@”之后的部分为发件域,配置发件域时请保持一致,发件域配置时会进行验证,发件人域必须使用认证后的发件域
若遇到请求失败,非邮件格式等错误情况,再次尝试(使用新的requestId,否则会幂等结果),部分失败原因存在请求速率过快导致。

请求参数示例

{  
    "request_id": "7874213545233465350", 
    "campaign_id":"1891498156651418748",
    "campaign_name":"活动名称",
    "from": "[[email protected]](mailto:[email protected])",  
    "subject": "winner gift",  
    "content": "thanks for your join,you will get  a gift",  
    "list_remark":"收件人分组说明",
    "emails": "[[email protected]](mailto:[email protected])",  
    "total": 1,  
    "reply_to": "[[email protected]](mailto:[email protected])",  
    "request_time": "11144441111",  
    "biz_param": ""  
}

响应参数说明

参数类型是否必填限制描述示例值
statusStringY最多20个字符批次状态码
all_success--全部成功
part_success--部分成功
fail--失败
all_success
batch_idStringY最多64个字符批次id8064284299267792899
messageStringY最多128个字符status的描述提交成功
batch_iso_timeStringYISO-8601响应时间2023-10-27T15:18:42.223+08:00
total_accepted_recipientsIntegerY总接收数,
当status=all_success时,与请求参数emails的个数一致;
当status=part_success时为成功的数量
当status=fail时,为0
2
total_rejected_recipientsIntegerY总拒绝数,
当status=all_success时,为0;
当status=part_success时为失败的数量
当status=fail时,与请求参数emails的个数一致
2
rcpt_to_errorsStringN对status=part_success时的错误数据描述信息[{"message":"invalid recipients[2] address.email: zhangweimambasms.com","code":"1300"},{"message":"invalid recipients[3] address.email: zhangwesmambasms.com","code":"1300"}]

响应参数示例

请求失败

{  
    "status": "fail",  
    "batchId": "8147366765119299585",  
    "message": "batch request exception",  
    "batchIsoTime": "2023-11-24T10:33:58.163+08:00",  
    "total_accepted_recipients": 0,  
    "total_rejected_recipients": 1,  
    "rcpt_to_errors": null  
}

全部成功

{  
    "status": "all_success",  
    "batchId": "8147529114883244033",  
    "message": "all_success",  
    "batchIsoTime": "2023-11-24T11:52:14.348+08:00",  
    "total_accepted_recipients": 1,  
    "total_rejected_recipients": 0,  
    "rcpt_to_errors": null  
}

部分成功

部分错误请求参数示例,例如邮件格式错误的数据

{
    "request_id": "7874213545233465350",
    "from": "[email protected]",
    "subject": "winner gift",
    "content": "thanks for your join,you will get  a gift",
    "emails": "[email protected],zhangweimambasms.com",
    "total": 2,
    "reply_to": "[email protected]",
    "request_time": "11144441111",
    "biz_param": "oookk"
}

响应结果

{
    "status": "part_success",
    "batchId": "8147529114883244037",
    "message": "part_success",
    "batchIsoTime": "2023-11-24T11:58:02.418+08:00",
    "total_accepted_recipients": 1,
    "total_rejected_recipients": 1,
    "rcpt_to_errors": "[{\"code\":\"1300\",\"message\":\"invalid recipients[1] address.email: zhangweimambasms.com\"}]"
}