gpt4 book ai didi

php - MailChimp API 2.0 批量订阅 PHP

转载 作者:塔克拉玛干 更新时间:2023-11-03 05:53:23 25 4
gpt4 key购买 nike

我无法在 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'));

关于php - MailChimp API 2.0 批量订阅 PHP,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23827585/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com