I use mailjet in my php program to send mails to my receivers. I use templates (or known as campaigns) as content of my mail. My code is ..
$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);
Note: I am hardcoding the template id (id:3594662) in my program. And the problem is .. Once i sent a mail , that template's status will change to "sent". So if i send another mail using the same template(id:3594662) i will get error message like this:
"errmessage": "Newsletter has to be in status draft or programmed",
"statuscode": "400
Please help me how to update the status of template to "draft or programmed".. Advance Thanks for the replies..