Postmark\PostmarkClient::getBounces PHP Method

getBounces() public method

Get a batch of bounces to be processed.
public getBounces ( integer $count = 100, integer $offset, string $type = NULL, boolean $inactive = NULL, string $emailFilter = NULL, string $tag = NULL, string $messageID = NULL )
$count integer Number of bounces to retrieve
$offset integer How many bounces to skip (when paging through bounces.)
$type string The bounce type. (see http://developer.postmarkapp.com/developer-api-bounce.html#bounce-types)
$inactive boolean Specifies if the bounce caused Postmark to deactivate this email.
$emailFilter string Filter by email address
$tag string Filter by tag
$messageID string Filter by MessageID :return DynamicResponseModel
    function getBounces($count = 100, $offset = 0, $type = NULL, $inactive = NULL, $emailFilter = NULL, $tag = NULL, $messageID = NULL)
    {
        $query = array();
        $query['type'] = $type;
        $query['inactive'] = $inactive;
        $query['emailFilter'] = $emailFilter;
        $query['tag'] = $tag;
        $query['messageID'] = $messageID;
        $query['count'] = $count;
        $query['offset'] = $offset;
        return new DynamicResponseModel($this->processRestRequest('GET', '/bounces', $query));
    }

Usage Example

 function testClientCanGetBounceDump()
 {
     $tk = parent::$testKeys;
     $client = new PostmarkClient($tk->READ_INBOUND_TEST_SERVER_TOKEN, $tk->TEST_TIMEOUT);
     $bounces = $client->getBounces(10, 0);
     $id = $bounces->Bounces[0]['ID'];
     $dump = $client->getBounceDump($id);
     $this->assertNotEmpty($dump);
 }