campaignBounceMessages()

Messages are received from email recipient server in cases email was hard bounced. Reports are obtained only about emails that are not older than 30 days. Email list with additional parameters is returned.

campaignBounceMessages(string $cid, integer $start, integer $limit) : array
Input parameters
  • cid - campaign ID/li>
  • start - page number starting from which selection will be made (optional). Default value is 0./li>
  • limit - number of results returned in one page (optional). Default value is 25. Maximum allowable value is 50./li>
Information obtained

Array of bounce messages. Each message is represented as an array that includes:

  • date - email reception date
  • email - recipient email address
  • message - content of hard bounced email

Examples

mgapi_campaignBounceMessages.php
campaignBounceMessages($cid, $start, $limit);
 
header("Content-Type: text/plain");
if ($api->errorCode) {
    echo "Unable to load campaignBounceMessages()!";
    echo "\tCode=" . $api->errorCode . "\n";
    echo "\tMsg=" . $api->errorMessage . "\n";
} else {
    echo "Messages returned: " . sizeof($retval) . "\n";
    foreach ($retval as $msg) {
        echo $msg['date'] . " - " . $msg['email'] . "\n";
        echo substr($msg['message'], 0, 150) . "\n\n";
    }
}
xml-rpc_campaignBounceMessages.php
 new xmlrpcval($apikey),
                    'cid' => new xmlrpcval($campaignId),
                    'start' => new xmlrpcval(0),
                    'limit' => new xmlrpcval(25)
                ),
                'struct');
$f = new xmlrpcmsg('campaignBounceMessages', array($v));
$c = new xmlrpc_client($apiUrl["path"], $apiUrl['host'], 80);
$c->setDebug($debug);
$r = &$c->send($f);
 
header("Content-Type: text/plain");
if (!$r->faultCode()) {
    $retval = php_xmlrpc_decode($r->value());
    echo "Messages returned: " . sizeof($retval) . "\n";
    foreach ($retval as $msg) {
        echo $msg['date'] . " - " . $msg['email'] . "\n";
        echo substr($msg['message'], 0, 150) . "\n\n";
    }
} else {
    echo "Unable to run campaignBounceMessages()!\n";
    echo "\tCode=" . $r->faultCode() . "\n";
    echo "\tMsg=" . $r->faultString() . "\n";
}
mgapi_campaignBounceMessages.py
from lib.config import * #contains apikey
from lib.MGAPI import MGAPI
 
# This Example shows how to ping using the MGAPI.php class and do some basic error checking.
 
api = MGAPI(apikey)
 
cid = campaignId
start = 0
limit = 25
 
retval = api.campaignBounceMessages(cid, start, limit)
if api.errorCode:
    print "Unable to load campaignBounceMessages()!"
    print "\tCode=", api.errorCode
    print "\tMsg=", api.errorMessage
else:
    print "Messages returned: %d" % (len(retval))
    for msg in retval:
        print "%s - %s" % (msg['date'], msg['email'])
        print msg['message'][0:150]

© 2010-2017 Mailigen. All rights reserved.