Send Email via MailChimp

I think the problem is around $api->listSubscribers()

include('../libs/mailchimp/MCAPI.class.php');

$options = array('list_id' => '$list_id', 'subject' => 'Prova', 'from_name' => 'name', 'from_email' => 'info@example.com');
$content = array('html' => '<p>Testo di prova</p>');

$api = new MCAPI($apikey);
$campaignId = $api->campaignCreate('trans', $options, $content);

$api->listSubscribe($options['list_id']);

$api->campaignSendNow($campaignId);

if ($api->errorCode){
    echo "Unable to Create New Campaign!";
    echo "\n\tCode=".$api->errorCode;
    echo "\n\tMsg=".$api->errorMessage."\n";
} else {
    echo "New Campaign ID:".$campaignId ."\n";
}

Why doesn't he send an email?

+3
source share
2 answers

You have a few questions here:

First, you do not perform error checking after every API call. If you take the error checking code from the bottom and paste it after calling listSubscribe (), you will immediately receive an error message because you are not transmitting any subscriber data (at least you need an email address). Docs for listSubscribe here

- listSubscribe, , listSubscribe double_optin, true ( ), , .

, , , . - , psuedo-trans , . , . , , psuedo-trans, , / .

+4

?

, api, :

$api = new MCAPI($apikey);

:

$api = new MCAPI('apikey');

API api: http://admin.mailchimp.com/account/api

+1

All Articles