suppressedListBatchSubscribe()

Array of recipients’ emails are passed and information about how many emails have been added to Global Suppression List (GSL) is returned.

suppressedListBatchSubscribe(array $batch) : struct

Input parameters
  • batch - array of emails. Each email is represented as an array.

Information obtained


Array consisting of:

  • success_count - number of successfully added emails
  • error_count - number of unsuccessfully added emails
  • errors - array of error messages about each email. Each error message is represented as an array consisting of fields:
    • code - error code
    • message - error message
    • email - email address that raised error

Examples

mgapi_suppressedListBatchSubscribe.php
<?php
/**
 * This Example shows how to suppressedListBatchSubscribe using the MGAPI.php class and do some basic error checking.
 */
require_once 'inc/MGAPI.class.php';
require_once 'inc/config.inc.php'; //contains apikey
 
$api = new MGAPI($apikey);
 
$batch = array();
$batch[] = array('EMAIL' => $my_email);
$batch[] = array('EMAIL' => $boss_man_email);
 
$retval = $api->suppressedListBatchSubscribe($batch);
 
header("Content-Type: text/plain");
if ($api->errorCode) {
    echo "Unable to load suppressedListBatchSubscribe()!\n";
    echo "\tCode=" . $api->errorCode . "\n";
    echo "\tMsg=" . $api->errorMessage . "\n";
} else {
    echo "success:" . $retval['success_count'] . "\n";
    echo "errors:" . $retval['error_count'] . "\n";
    foreach ($retval['errors'] as $val) {
        echo "\t*" . $val['email'] . " failed\n";
        echo "\tcode:" . $val['code'] . "\n";
        echo "\tmsg :" . $val['message'] . "\n\n";
    }
}

© 2010-2018 Mailigen. All rights reserved.