我无法在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
)
)
答案 0 :(得分:19)
电子邮件应该是结构,而不是字符串。
$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'));