当使用Mailchimp API 3列表/成员方法时,有没有办法发送Mailchimp欢迎邮件?旧的API实现可以在不需要自动化(付费功能)的情况下实现,但我不确定API 3是否以List/Member方法支持它。我指的是用户在使用标准Mailchimp表单注册时通常会收到的电子邮件。使用Mailchimp API发送欢迎邮件3列表/成员方法
例如,此script不会发送欢迎电子邮件或任何其他注册后的Mailchimp电子邮件。
$apikey = '<api_key>';
$auth = base64_encode('user:'.$apikey);
$data = array(
'apikey' => $apikey,
'email_address' => $email,
'status' => 'subscribed',
'merge_fields' => array(
'FNAME' => $name
)
);
$json_data = json_encode($data);
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, 'https://us2.api.mailchimp.com/3.0/lists/<list_id>/members/');
curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json', 'Authorization: Basic '.$auth));
curl_setopt($ch, CURLOPT_USERAGENT, 'PHP-MCAPI/2.0');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, $json_data);
$result = curl_exec($ch);
var_dump($result);
die('Mailchimp executed');
看到我下面的评论:改变状态为“等待”将做的伎俩。 – Wietse