I want to subscribe a user to mailchimp list like that:
require_once( get_template_directory().'/inc/Mailchimp.php');
$listId='********';
$merge_vars=array(
'FNAME' => $name
);
$apiKey='***********************';
$mailChimp=new Mailchimp($apiKey);
$result=$mailChimp->lists->subscribe($listId, array('email'=>$email),
$merge_vars,false,true,true,false);
And I get a result from mailchimp:
[email] => aa@s.co
[euid] => *****
[leid] => *****
It looks like it is working and really sign this user, but when I get in to mailchimp the list is empty!
I tried to wait few days and see maybe it will update, but no…
Someone know why?
The 6th param (
$double_optin
) must be set tofalse
if you want direct subscription.When
true
, users receive a confirmation mail before and are added to the list once they’ve clicked the button in this mail.MailChimp warns about this param :
"Abusing this may cause your account to be suspended."
. See here : https://apidocs.mailchimp.com/api/2.0/lists/subscribe.php