This function removes recipient email from existing list with all additional field values. The functionality is similar if recipient unsubscribes using unsubscribe link.

listUnsubscribe(string $id, string $email_address, boolean $delete_member, boolean $send_goodbye, boolean $send_notify) : boolean
Only active contacts can be unsubscribed or deleted. This function will not work on inactive or already unsubscribed recipients.
Input parametrs
  • id - list ID
  • email_address - email address or ID (can be found by listMemberInfo function, see Obtaining additional email information)
  • delete_member - whether recipient is deleted from existing list (true, false) (optional). Default value is false.
  • send_goodbye - whether notification is sent to the removed email (true, false) (optional).  Default value is true.
  • send_notify - whether notification is sent to sender email which is indicated for a particular list (true, false) (optional). Default value is true.
Information obtained:
  • true, if request for removing email has succeeded


listUnsubscribe($id, $email_address, $delete_member, $send_goodbye, $send_notify);
header("Content-Type: text/plain");
if ($api->errorCode) {
    echo "Unable to load listUnsubscribe()!\n";
    echo "\tCode=" . $api->errorCode . "\n";
    echo "\tMsg=" . $api->errorMessage . "\n";
} else {
    echo "Returned: " . $retval . "\n";
 new xmlrpcval($apikey),
                    'id' => new xmlrpcval($listId),
                    'email_address' => new xmlrpcval($my_email),
                    'delete_member' => new xmlrpcval(false),
                    'send_goodbye' => new xmlrpcval(true),
                    'send_notify' => new xmlrpcval(false)
$f = new xmlrpcmsg('listUnsubscribe', array($v));
$c = new xmlrpc_client($apiUrl["path"], $apiUrl['host'], 80);
$r = &$c->send($f);
header("Content-Type: text/plain");
if (!$r->faultCode()) {
    $retval = php_xmlrpc_decode($r->value());
    echo "Returned: " . $retval . "\n";
} else {
    echo "Unable to load listBatchUnsubscribe()!\n";
    echo "\tCode=" . $r->faultCode() . "\n";
    echo "\tMsg=" . $r->faultString() . "\n";
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)
id = listId
email_address = my_email
delete_member = False
send_goodbye = True
send_notify = False
retval = api.listUnsubscribe(id, email_address, delete_member, send_goodbye, send_notify)
if api.errorCode:
    print "Unable to load listUnsubscribe()!"
    print "\tCode=", api.errorCode
    print "\tMsg=", api.errorMessage
    print "Returned: ", retval

© 2010-2020 Mailigen. All rights reserved.