我在我的 php 程序中使用 mailjet 向我的接收者发送邮件。我使用模板(或称为活动)作为我的邮件内容。我的代码是..
$ch = curl_init();
$content = "https://api.mailjet.com/v3/REST/newsletter/3594662/send";
curl_setopt($ch, CURLOPT_URL,$content);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_FTPLISTONLY, 1);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($ch, CURLOPT_USERPWD, "myapi:mypassword");
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
$server_output1 = curl_exec ($ch);
# Close curl process
curl_close ($ch);
注意:我在我的程序中硬编码模板 id (id:3594662)。问题是..一旦我发送了邮件,该模板的状态将变为“已发送”。因此,如果我使用相同的模板(id:3594662)发送另一封邮件,我将收到如下错误消息:
"errmessage": "Newsletter has to be in status draft or programmed",
"statuscode": "400
请帮助我如何将模板的状态更新为“草稿或编程”..提前感谢您的回复..