Service: GetEmailAddresses

The GetEmailAddresses service allows you to request your email addresses for Flexmail. The can be requested by: asking for one or more mailing lists, asking for one or more groups or individually by asking for flexmail ids or reference ids.

Service Details

SOAP Action: GetEmailAddresses
SOAP Return Object: GetEmailAddressesResp

Input

The following table describes the parameters used for calling the GetEmailAddresses service.

Table: instance of GetEmailAddressesReq

Parameter Mandatory Type Description
header Y APIRequestHeader Header for authentication
mailingListIds / Array of Integer A list of mailing list ids
groupIds / Array of Integer A list of group ids
emailAddressTypeItems / Array of EmailAddressType A list of emailAddressTypeItems with either flexmailId or referenceId set
limit / Pagination Limit the amount of items to be returned
order / Ordening Order the items
states / Array of String An array of account states to return, default: active
Options: active, deleted, unsubscribed, bounced-out, blacklisted, awaiting-opt-in-confirmation
preferenceIds / Array of Integer A list of preference ids

Output

The following table describes the parameters returned from the GetEmailAddresses service.

Table: instance of GetEmailAddressesResp

Parameter Mandatory Type Description
header / APIResponseHeader Header containing authentication information
errorCode / Integer Numerical value of the error
errorMessage / String Short literal description of the error
emailAddressTypeItems / Array of EmailAddressType List of the requested email addresses

Table: response codes of GetEmailAddressesResp.

0 No error
220 Authentication error, see header object for detailed information
221 Invalid mailing list id
222 Invalid group id
223 Invalid flexmail id
224 Invalid reference id
225 Invalid flexmail or reference id
226 Either emailAddressTypeItems, mailingListIds, groupIds or preferenceIds is mandatory

Example

This example shows you how to get a list of all email addresses within flexmail.

<?php
$header = new stdClass();
$header->userId = USER_ID;
$header->userToken = USER_TOKEN;

$GetEmailAddressReq = new stdClass();
// To request all email addresses from 2 mailing lists use this code
$GetEmailAddressReq->header = $header;
$GetEmailAddressReq->mailingListIds = array(1,2);

// To request all email address from subscribers to 2 groups
    /*
$GetEmailAddressesReq->header = $header;
$GetEmailAddressesReq->groupIds = array(1001,1002);*/

// Request an email with a flexmail id
$GetEmailAddressesReq->header = $header;
$GetEmailAddressesReq->emailAddressTypeItems = array();

// for flexmail id usage
$address_1 = new stdClass;
$address_1->flexmailId = 123456;
array_push($GetEmailAddressReq->emailAddressTypeItems, $address_1);

// for reference id usage
$address_2 = new stdClass;
$address_2->referenceId = "my-ref-1234";
$address_3 = new stdClass;
$address_3->referenceId = "my-ref-1235";
array_push($GetEmailAddressReq->emailAddressTypeItems, $address_2);
array_push($GetEmailAddressReq->emailAddressTypeItems, $address_3);

// execute on of the above requests
$GetEmailAddressesResp = $SoapClient->__soapCall("GetEmailAddresses", array($GetEmailAddressReq));

if ($GetEmailAddressesResp->errorCode == 0) {

    echo "Retrieved email addresses";

    foreach ($GetEmailAddressesResp->emailAddressTypeItems as $email) {
        echo $email->flexmailId . "-" . $email->email . "<br />";
    }
} else {
    echo "Could not retrieve email addresses: " . $createMessageResp->errorMessage;
}?>