XXXXXX是注册时sendinblue生成的密钥,并生成api-key的密钥
$curl = curl_init ();
$headers[] = 'Content-Type: application/json';
$headers[] = 'api-key: XXXXXX';
curl_setopt_array($curl, array(
CURLOPT_HEADER => 0, //TRUE para incluir el header en el output
CURLOPT_HTTPHEADER => $headers,
CURLOPT_URL => "https://api.sendinblue.com/v3/emailCampaigns",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => "{\"recipients\":{\"listIds\":[\"2\"]},\"tag\":\"Ninguna\",\"sender\":{\"name\":\"{'name':'xyz' , 'email':'jrodriguez@cidesa.com.ve'}\",\"email\":\"jrodriguez@cidesa.com.ve\"},\"name\":\"JonathanG\",\"htmlContent\":\"La demostración usa derivadas\",\"subject\":\"Mi tema\",\"replyTo\":\"jonathangrodriguezt@gmail.com\",\"footer\":\"mi pie\",\"header\":\"mi cabeza\"}",
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo "<pre>";
echo print_r(json_decode($response,true));
echo "</pre>";
}
执行此错误时您会看到cogigo
[code] => document_not_found
[message] => One or more list ids are not valid. Please enter valid list ids
我不知道我在做什么错误的附件图像和地址(https://developers.sendinblue.com/reference#createemailcampaign-1) 我正在寻找的是创建一个要在代码中发送的广告系列消息,取代了将在图片中以蓝色标记的列表,其中用于生成代码的参数将联系人的ID,列表,以及联系人的邮件,但都没有帮助我。 (第二张图片联系方式)
第一张图片
第二张图片
答案 0 :(得分:0)
尝试使用: $数据=数组( “名称” => $ title, “发件人” => new \ SendinBlue \ Client \ Model \ CreateEmailCampaignSender(array('name'=> $ from,'email'=> $ replay)), “ templateId” => $ template_id, “ scheduledAt” => date('c',strtotime('2019-05-22 10:00:00')), “ subject” => $ subject, “ replyTo” => $ replay, “收件人” =>数组(“ listIds” =>数组(intval($ list_id))), “ inlineImageActivation” => true );
用于测试,首先将列表ID作为数字,然后尝试使用intval($ list_id)