This is my List in my MailChimp. List name: Clients
I am trying to send an email to email: "rajbiswas176@gmail.com" by using MailChimp API.
My PHP code is here:
<?php
/*
$apikey = 'my_api-key-goes_here';
$list_id = 'list_id_of_Clients_goes_here';
*/
$apikey = 'my_api-key-goes_here';
$to_emails = array('rajbiswas176@gmail.com');
$to_names = array('Raj');
$message = array(
'html'=>'Yo, this is the <b>html</b> portion',
'text'=>'Yo, this is the *text* portion',
'subject'=>'This is the subject',
'from_name'=>'Me!',
'from_email'=>'raj.biswas936@gmail.com',
'to_email'=>$to_emails,
'to_name'=>$to_names
);
$tags = array('WelcomeEmail');
$params = array(
'apikey'=>$apikey,
'message'=>$message,
'track_opens'=>true,
'track_clicks'=>false,
'tags'=>$tags
);
$url = "http://us1.sts.mailchimp.com/1.0/SendEmail";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url.'?'.http_build_query($params));
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
echo $result;
curl_close ($ch);
$data = json_decode($result);
echo "Status = ".$data->status."\n";
?>
But when I am running this script, the output I get is "Status =". And the mail which I am trying to send is not sent also. Where am I wrong? How can I send email to a particular email from the list using MailChimp API
Thank you in advance.