//GET请求示例:
Request URL:
https://api.itniotech.com/email/getSendEmailRcd?appId=fKFtblIy&emailId=2208031112341000001,2208031112361000002
Request Method:
GET
Request Headers:
Content-Type: application/json;charset=UTF-8
Sign: 05d7a50893e22a5c4bb3216ae3396c7c
Timestamp: 1630468800
Api-Key: bDqJFiq9
//POST请求示例:
Request URL:
https://api.itniotech.com/email/getSendEmailRcd
Request Method:
POST
Request Headers:
Content-Type: application/json;charset=UTF-8
Sign: 05d7a50893e22a5c4bb3216ae3396c7c
Timestamp: 1630468800
Api-Key: bDqJFiq9
Request Body:
{
"appId":"fKFtblIy",
"emailId":"2208031112341000001"
}
参数 | 说明 | 类型 |
---|---|---|
status | 状态码,0成功,其他失败参见邮件响应状态码说明 | String |
success | 发送成功的邮件封数 | String |
fail | 发送失败的邮件封数 | String |
sending | 正在发送的封数 | String |
nofound | Id未找到的条数(包含队列中的邮件) | String |
array | 找到发送结果的json集合 | JSONArray |
emailId | 提交邮件对应平台emailId | String |
toAddress | 提交收件人地址(邮箱地址) | String |
receiveTime | 发送时间,ISO8601标准时间格式(2021-02-12T09:30:03+08:00) | String |
status | 发送状态:0发送成功,-1:发送中,1:发送失败 | String |
注:提交发送邮件成功后,系统会给每个提交成功的号码对应生成一个平台emailId,后续客户可以根据这个emailId来查询该邮件的发送结果。
status | 状态说明 |
---|---|
0 | 成功 |
-1 | 身份验证错误 |
-4 | 用户锁定 |
-5 | 字段为空或查询ID异常 |
-6 | 时间戳过期 |
-8 | 限制IP访问 |
-23 | 端口或者程序异常 |
-24 | 您的账号未验证,请验证! |
-28 | 一次只能查询200个emailID,超过最大查询限制 |
Java
PHP
Curl
Python
REQUEST
import cn.hutool.crypto.SecureUtil;
import cn.hutool.http.Header;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import cn.hutool.json.JSONUtil;
import java.time.LocalDateTime;
import java.time.ZoneId;
public void getSendEmailRcd(){
final String baseUrl = "https://api.itniotech.com/email";
final String apiKey = "your api key";
final String apiPwd = "your api secret";
final String appId = "{{appId}}";
final String emailId = "{{emailId}}";
final String url = baseUrl.concat("/getSendEmailRcd");
HttpRequest request = HttpRequest.post(url);
// currentTime
final String datetime = String.valueOf(LocalDateTime.now().atZone(ZoneId.systemDefault()).toInstant().getEpochSecond());
// generate md5 key
final String sign = SecureUtil.md5(apiKey.concat(apiPwd).concat(datetime));
request.header(Header.CONNECTION, "Keep-Alive")
.header(Header.CONTENT_TYPE, "application/json;charset=UTF-8")
.header("Sign", sign) //Signature with encryption
.header("Timestamp", datetime) //Current system time stamp (second)
.header("Api-Key", apiKey); //API KEY(Home-Developer options)
final String params = JSONUtil.createObj()
.set("appId", appId)
.set("emailId", emailId)
.toString();
HttpResponse response = request.body(params).execute();
if (response.isOk()) {
String result = response.body();
System.out.println(result);
}
}
REQUEST
header('content-type:text/html;charset=utf8');
$apiKey = "your api key";
$apiSecret = "your api secret";
$appId = "{{appId}}";
$timeStamp = time();
$sign = md5($apiKey . $apiSecret . $timeStamp);
$emailId = "{{emailId}}";
$url = "https://api.itniotech.com/email/getSendEmailRcd?appId=$appId&emailId=$emailId";
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => $url,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 0,
CURLOPT_SSL_VERIFYPEER => 0,
CURLOPT_SSL_VERIFYHOST => 0,
CURLOPT_CUSTOMREQUEST => 'GET',
CURLOPT_HTTPHEADER => array(
"Content-Type: application/json;charset=UTF-8",
"Sign: $sign",
"Timestamp: $timeStamp",
"Api-Key: $apiKey"
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
REQUEST
curl --location --request GET 'https://api.itniotech.com/email/getSendEmailRcd'
--header 'Content-Type: application/json;charset=UTF-8'
--header 'Sign: {sign}'
--header 'Timestamp: {datetime}'
--header 'Api-Key: {apiKey}'
--data-raw '{"appId": "{{appId}}","emailId": "{{emailId}}",}'
REQUEST
import hashlib
import time
import requests
import json
base_url = "https://api.itniotech.com/email/getSendEmailRcd"
api_key = "your api key"
api_pwd = "your api secret"
app_id = "{{appId}}"
emailId = "{{emailId}}";
timestamp = int(time.time())
s = "%s%s%s" % (api_key, api_pwd, str(timestamp))
sign = hashlib.md5(s.encode(encoding='UTF-8')).hexdigest()
headers = {
'Content-Type': 'application/json;charset=utf-8',
'Sign': sign,
'Timestamp': str(timestamp),
'Api-Key': api_key
}
params = {"appId": app_id, "emailId": emailId}
print(params)
rsp = requests.get(base_url, params, headers=headers)
if rsp.status_code == 200:
data = json.loads(rsp.text)
print(data)
RESPONSEEXAMPLE
{
"status": "0",
"reason": "success",
"success": "0",
"fail": "2",
"sending": "0",
"nofound": "0",
"array": [
{
"emailId": "2208031112341000001",
"toAddress": "123@qq.com",
"receiveTime": "",
"status": "1"
}
]
}