Jump to content

Unsubscribe()

Changes a subscriber's status to Unsubscribed, so they will no longer receive emails sent to the specified contact list.

Parameters

ApiKey (Required)
    Your application authentication key. Click here to find out more.
ListID (Required)
    The ID number of the list from which you wish to unsubscribe the email address. Click here to find out more.
Email (Required)
    The email address of the subscriber you would like to unsubscribe

Return Value

On success, this method returns a "success" response (code 0).

On failure, a SOAP fault exception is thrown with one of the fault codes below.

Usage Notes

ReturnActive returns only 200 subscribers at a time, for performance reasons. If the returned Subscriber Count exceeds 200, invoke ReturnActive again for each subsequent 200, specifying the appropriate StartIndex offset parameter each time.

If the Date parameter is specified, the Subscriber Count value will reflect the total number of active subscribers that fit the date filter.

Fault Codes

1- Invalid Email Address
    The supplied email address is invalid or does not exist
20 - Invalid ListID
    The Associated List is not valid
100 - Invalid API Key
    The API key is not valid or expired

SOAP Sample Request


    
    
        
            
                STRING
                INT
                STRING
            
        
    

SOAP Sample Response


    
    
        
            
                INT
                STRING
            
        
    

Code Sample - PHP

// Import the eConnect Email API Toolkit
require_once('eConnectEmail_API_Toolkit.php');

$eConnectEmailApi = TheKeyMakerClient('YOUR_API_KEY');

$result = $eConnectEmailApi->Unsubscribe(LIST_ID, 'EMAIL_ADDRESS');

// Show the results
print 'Response: <pre>';
print_r($result);
print '</pre>';

Code Sample - ASP.NET C#

            TheKeyMaker_v20 api = new TheKeyMaker_v20();
            // Set up input parameters
            EmailParams emailParams = new EmailParams();
            emailParams.ApiKey = txtApiKey.Text;
            emailParams.ListID = int.Parse(txtUnsubListID.Text);
            emailParams.Email = txtUnsubEmail.Text;

            // Invoke method and store result
            CodeReturnValues unsubReturn = api.Unsubscribe(emailParams);

            // Display results
            lblResult.Text = FormatValue("Code", unsubReturn.Code.ToString())
                + FormatValue("Response", unsubReturn.Response);