我在这里以及其他几个网站上阅读了多个主题。他们都说能够禁用双重选择我需要将用户注册为“已订阅”。那没用。 这是我的代码:
$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;
}
当我尝试从帐户中禁用双重选择时,它显示为灰色并且不会让我取消选中它:
如果您有任何想法,我很乐意听到。 谢谢!
答案 0 :(得分:1)
听起来MailMail帐户可能处于合规状态。有时,这可能要求列表为双重加入模式。我将登录到该帐户,然后在右上角查找是否有这种情况的通知。
希望这对您有帮助!