我有一个Mailchimp列表,该列表在Mailchimp语言设置中设置为“自动翻译”。
我希望能够以英语和德语发送选择加入的邮件,具体取决于最终用户的浏览器。
我当前正在发送接受语言标头,但mailchimp只是忽略了它。它仍以默认语言发送每个选择加入的邮件。其他所有邮件都可以进行翻译-仅选择加入即可。
该重大问题是否有任何解决方法?
已尝试: https://github.com/drewm/mailchimp-api/issues/148
function mc_subscribe($email, $lang, $fname, $lname, $empf, $debug, $apikey, $listid, $server) {
$auth = base64_encode( 'user:'.$apikey );
$data = array(
'apikey' => $apikey,
'email_address' => $email,
'status' => 'pending',
'language' => $lang,
'merge_fields' => array(
'FNAME' => $fname,
'LNAME' => $lname,
'EMPF' => $empf,
)
);
$json_data = json_encode($data);
$ch = curl_init();
$headers = array(
'Content-Type: application/json',
'Authorization: Basic '.$auth,
'Accept-Language: '.$lang);
writeLog($headers);
curl_setopt($ch, CURLOPT_URL, 'https://'.$server.'api.mailchimp.com/3.0/lists/'.$listid.'/members/');
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
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);
if ($debug) {
writeLog($result);
}
}