php - 使用 PHP 在 Mailchimp api 3.0 中禁用双重选择
问题描述
我在这里和其他几个网站上阅读了多个主题。他们都说要禁用双重选择,我需要将用户注册为“订阅”。那没有用。这是我的代码:
$data = [
'email' => $_GET['email'],
'status' => 'subscribed'
];
syncMailchimp($data);
static function syncMailchimp($data) {
$apiKey = 'XXXXXXXXXXX-us3';
$listId = 'XXXXXXXXXX';
$memberId = md5(strtolower($data['email']));
$dataCenter = substr($apiKey,strpos($apiKey,'-')+1);
$url = 'https://' . $dataCenter . '.api.mailchimp.com/3.0/lists/' . $listId . '/members/' . $memberId;
$json = json_encode([
'email_address' => $data['email'],
'status' => $data['status'], // "subscribed","unsubscribed","cleaned","pending"
]);
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_USERPWD, 'user:' . $apiKey);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Content-Type: application/json']);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_TIMEOUT, 10);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PUT');
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_POSTFIELDS, $json);
$result = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
return $httpCode;
}
当我尝试从帐户中禁用双重选择加入时,它显示为灰色并且不允许我取消选中它:
如果你有任何想法,我很想听听。谢谢!
解决方案
It sounds like that MailChimp Account might be in a compliance state. Sometimes this can require that lists be double opt-in mode. I would log into that account and look for any notifications in the top top-right-hand corner that would indicate that this is the case.
Hope this helps out!
推荐阅读
- ios - 如何在 iOS 中检测国家和州?
- javascript - 如何导入 json 文件以在 vis.js 中显示网络中的标题节点
- spring-boot - Spring Boot (v2.1.6) Microsoft Planner 集成
- ios - 在 Marketing Cloud 中创建的电子邮件在适用于 iOS 的 Outlook Mobile 应用程序上没有完全响应
- php - 尝试从 Azure 托管的 PHP 应用程序连接到 SQL Server,但出现错误 (ODBC)
- python - 如何从“类”HTML标签中查找文本匹配?
- regex - 正则表达式负前瞻问题确保仅在第一组中没有重复字符
- vim - 如何修复 Vim 中的 Leader Key Beep?
- c# - 从带有 PIC16F877 (MikroC IDE) 的 c# 接口接收 3 位数
- vb.net - 循环访问存储在 csv 文件中的数据时的良好做法