You are here

function MCAPI::listBatchSubscribe in Mailchimp 7

Same name and namespace in other branches
  1. 5.2 MCAPI.class.php \MCAPI::listBatchSubscribe()
  2. 5 MCAPI.class.php \MCAPI::listBatchSubscribe()
  3. 6.2 MCAPI.class.php \MCAPI::listBatchSubscribe()
  4. 6 MCAPI.class.php \MCAPI::listBatchSubscribe()

Subscribe a batch of email addresses to a list at once

Related

@example mcapi_listBatchSubscribe.php @example xml-rpc_listBatchSubscribe.php

@returnf integer success_count Number of email addresses that were succesfully added/updated @returnf integer error_count Number of email addresses that failed during addition/updating @returnf array errors Array of error structs. Each error struct will contain "code", "message", and the full struct that failed

Parameters

string $id the list id to connect to. Get by calling lists():

array $batch an array of structs for each address to import with two special keys: "EMAIL" for the email address, and "EMAIL_TYPE" for the email type option (html, text, or mobile):

boolean $double_optin flag to control whether to send an opt-in confirmation email - defaults to true:

boolean $update_existing flag to control whether to update members that are already subscribed to the list or to return an error, defaults to false (return error):

boolean $replace_interests flag to determine whether we replace the interest groups with the updated groups provided, or we add the provided groups to the member's interest groups (optional, defaults to true):

Return value

struct Array of result counts and any errors that occurred

File

./MCAPI.class.php, line 1251

Class

MCAPI

Code

function listBatchSubscribe($id, $batch, $double_optin = true, $update_existing = false, $replace_interests = true) {
  $params = array();
  $params["id"] = $id;
  $params["batch"] = $batch;
  $params["double_optin"] = $double_optin;
  $params["update_existing"] = $update_existing;
  $params["replace_interests"] = $replace_interests;
  return $this
    ->callServer("listBatchSubscribe", $params);
}