function unsubscribeContactByExternalId($externalId, $mailingId = "", $reasons = null)
    {
        $queryParameters = array();
        if (!empty($mailingId)) {
            $queryParameters['mailingId'] = $mailingId;
        }

        if (!empty($reasons)) {
            if (is_array($reasons)) {
                $queryParameters = $this->appendArrayFields($queryParameters, 'reason', $reasons);
            } else {
                $queryParameters['reason'] = urlencode($reasons);
            }
        }

        $encodedExternalId = utf8_encode($externalId);
        return $this->delete("contacts/externalid/${encodedExternalId}/unsubscribe", $queryParameters);
    }
function unsubscribeContactByExternalId($externalId, $mailingId = "", $reasons = null)
    {
        $queryParameters = array();
        if (!empty($mailingId)) {
            $queryParameters['mailingId'] = $mailingId;
        }

        if (!empty($reasons)) {
            if (is_array($reasons)) {
                $queryParameters = $this->appendArrayFields($queryParameters, 'reason', $reasons);
            } else {
                $queryParameters['reason'] = urlencode($reasons);
            }
        }

        $encodedExternalId = utf8_encode($externalId);
        return $this->delete("contacts/externalid/${encodedExternalId}/unsubscribe", $queryParameters);
    }
function unsubscribeContactByExternalId ( $ externalId , $ mailingId = "" , $ reasons = null ) { $ queryParameters = array ( ) ; if ( ! empty ( $ mailingId ) ) { $ queryParameters [ 'mailingId' ] = $ mailingId ; } if ( ! empty ( $ reasons ) ) { if ( is_array ( $ reasons ) ) { $ queryParameters = $ this -> appendArrayFields ( $ queryParameters , 'reason' , $ reasons ) ; } else { $ queryParameters [ 'reason' ] = urlencode ( $ reasons ) ; } } $ encodedExternalId = utf8_encode ( $ externalId ) ; return $ this -> delete ( "contacts/externalid/${encodedExternalId}/unsubscribe" , $ queryParameters ) ; }
This method unsubscribes a contact from Maileon using the external id.

@param string $externalId The external ID of the contact.
@param long $mailingId The ID of the mailing to assign the unsubscribe to. the mailing must have been sent, i.e. be sealed.
@param array $reasons an array of reasons or a single reason (string). Unsubscription reasons have two layers
of information, see http://dev.maileon.com/api/rest-api-1-0/contacts/unsubscribe-contacts-external-id for more details about the format.
The parameter(s) will be url-encoded by the client, you do not need to provide urlencoded strings.
@return \em com_maileon_api_MaileonAPIResult
the result object of the API call
@throws com_maileon_api_MaileonAPIException
if there was a connection problem or a server error occurred
This method unsubscribes a contact from Maileon using the external id .