You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何通过PHP调用Mailchimp API 3.0禁用双重选择加入?

Mailchimp Double Opt-In Won't Disable: Status Set to "subscribed" Fails + Account Option Grayed Out

I've scoured through numerous forum posts and websites, all stating that setting a user's status to "subscribed" via the Mailchimp API should bypass double opt-in. But unfortunately, this method isn't working for me at all.

Here's the PHP code I'm using to sync users to Mailchimp:

$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; 
}

To make matters worse, when I try to disable double opt-in directly in my Mailchimp account settings, the option is grayed out and I can't uncheck it:

Screenshot Context: The "Double opt-in" checkbox in my list's signup form settings is locked (gray) with a checkmark, and there's no way to toggle it off.

I'm really stuck here—could anyone please help me figure out a solution to disable double opt-in? Thanks a ton!

内容的提问来源于stack exchange,提问作者Avi

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.29 08:38:26