Mailchimp API: localized opt-in emails

Avatar of Felix Nagel Felix Nagel - 16. März 2015 - English, Webentwicklung

© MailChimp, mailchimp.com

When using the MailChimp API 2.0 to subscribe a new user to a list you want to send opt-in emails. You want to use MailChimps auto translate feature (Lists -> Signup forms -> Translate it) so your subscribers receive localized emails.

 

In order to set the correct language for each user you probably already use the mc_language option within the merge_vars array as stated in the official documentation.

 


Problem: Emails are still localized using default language as set for the list in MailChimp.

 

Solution: You need to set the Accept-Language HTTP header for the API call.

<?php
$curlHandle = curl_init();
$curlHeaderOptions = array(
    'Content-Type: application/json',
    'Accept-Language: de',
);
curl_setopt($curlHandle, CURLOPT_HTTPHEADER, $curlHeaderOptions);
?>

This feature is not documented yet. Source (direct), thanks to the MailChimp API Twitter team.

Die Kommentarfunktion ist für diesen Artikel deaktiviert.

0 Kommentare