Я не могу подписаться на несколько писем в MailChimp. Использование 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);
Я получаю следующую ошибку:
[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 ) )
Электронная почта должна быть структурой, а не строкой.
$batch[] = array('email' => 'user1@mail.com'); $batch[] = array('email' => 'user2@mail.com');
Должно быть
$batch[] = array('email' => array('email' => 'user1@mail.com')); $batch[] = array('email' => array('email' => 'user2@mail.com'));