I am not able to subscribe multiple emails in MailChimp. Using API https://bitbucket.org/mailchimp/mailchimp-api-php/downloads
$api_key = "***";
$list_id = "***";
require ('api/Mailchimp.php');
$Mailchimp = new Mailchimp($api_key);
$Mailchimp_Lists = new Mailchimp_Lists($Mailchimp);
$batch[] = array('email' => 'user1@mail.com');
$batch[] = array('email' => 'user2@mail.com');
$subscriber = $Mailchimp_Lists -> batchSubscribe($list_id, $batch, false, false, true);
I am getting following Error:
[errors] => Array
(
[0] => Array
(
[code] => -99
[error] => An email address must contain a single @
[email] => user1@mail.com
)
[0] => Array
(
[code] => -99
[error] => An email address must contain a single @
[email] => user2@mail.com
)
)
Email should be a struct, not a string.
$batch[] = array('email' => 'user1@mail.com');
$batch[] = array('email' => 'user2@mail.com');
Should be
$batch[] = array('email' => array('email' => 'user1@mail.com'));
$batch[] = array('email' => array('email' => 'user2@mail.com'));
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.