listUnsubscribe(string apikey, string id, string email_address, boolean delete_member, boolean send_goodbye, boolean send_notify)
Unsubscribe the given email address from the list
| Section | List Related |
|---|
| Parameters | |
|---|---|
| apikey | a valid API Key for your user account. Get by calling Get by visiting your API dashboard |
| id | the list id to connect to. Get by calling lists() |
| email_address | the email address to unsubscribe |
| delete_member | flag to completely delete the member from your list instead of just unsubscribing, default to false |
| send_goodbye | flag to send the goodbye email to the email address, defaults to true |
| send_notify | flag to send the unsubscribe notification email to the address defined in the list email notification settings, defaults to true |
| Returns | |
|---|---|
| boolean | true on success, false on failure. When using MCAPI.class.php, the value can be tested and error messages pulled from the MCAPI object (see below) |
[1] mcapi_listUnsubscribe.php
<?php /** This Example shows how to pull the Info for a Member of a List using the MCAPI.php class and do some basic error checking. **/ require_once 'inc/MCAPI.class.php'; require_once 'inc/config.inc.php'; //contains apikey $retval = $api->listUnsubscribe( $listId,$my_email); if ($api->errorCode){ } else { }
[2] xml-rpc_listUnsubscribe.php
<?php /** This Example shows how to Unsubscribe a member from a List using XML-RPC. Note that we are using the PEAR XML-RPC client and recommend others do as well. **/ require_once 'XML/RPC2/Client.php'; require_once 'inc/config.inc.php'; try { $result = $client->listUnsubscribe($apikey, $listId, $my_email,false, false, false); } catch (XML_RPC2_FaultException $e){ } ?>