Am trying to create campaign/send mail to my mailchimp account so I referenced solutions found here source which works great via the code below
My issues:
Now from the mailchimp api, I did not see where to include the message body or the message content in the api. Has anyone done this. can someone help me out
here is the mailchimp API API link
$data = array("recipients" => array("list_id" => "205d96e6b4"), "type" => "regular", "settings" => array("subject_line" => "Subject", "title" => "Title", "reply_to" => "test@gmail.com", "from_name" => "Test", "folder_id" => "8888969b77"));
$data = json_encode($data);
$curl = curl_init();
curl_setopt_array($curl, array(
//Sample url
CURLOPT_URL => "https://xxx.api.mailchimp.com/3.0/campaigns",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 30,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => $data,
CURLOPT_HTTPHEADER => array(
"authorization: apikey <your_apikey>"
),
));
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
$response = $err;
}