English Webentwicklung

Mailchimp API: localized opt-in emails

16. März 2015 · Lesezeit 1 Min. · von Felix Nagel

© MailChimp · mailchimp.com

Note: This post is quite old, the information may be outdated.


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);
?>
Send localized MailChimp emails: set curl options for PHP API call

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

Avatar of Felix Nagel
Felix Nagel

Freiberuflicher TYPO3 CMS & Symfony Entwickler mit über 15 Jahren Erfahrung. Schreibt über TYPO3, Symfony, Frontend-Entwicklung und Open Source.

Kommentare 0

Die Kommentarfunktion ist für diesen Artikel deaktiviert.