Problem with API v2 (PHP)

I don't have the time to change to the new shiney API at present for a project I am working on, will do fo rthe next one, however I'm having a very strang issue!

I have a dev account with 2 list on and users can join/leave this lists at any time. Every combination I try works perfectly, until I go from a Yes/Yes to a Yes/No or No/Yes combo, then the user gets unsubscribed from both lists. If I go from a No/No position to Yes/No or No/Yes it works as expected... it's very odd! All i can guess is that my unsubscribe is removing from all lists or soemthing, as the code logic works correct.

function mail_unsubscribe($email, $list-_key)
// -----------------------------------------------------------------------------
// remove user from list
// -----------------------------------------------------------------------------
{
    // create campaign monitor class
    $cm = new CampaignMonitor($api_key, NULL, NULL, $list_key);

    // remove subscriber
    $result = $cm->subscriberUnsubscribe($email, $list_key);

    // return result as needed
    if($result['Result']['Code'] == 0)
        return TRUE;
    else
    {
        dev_log("Mail unsubscribe failed $email $list_key ".print_r($result,TRUE));
        return FALSE;
    }

Pretty simple function, so what am I missing.

tobyb tobyb, 5 years ago

Hey Mat-Moo,

I'd say that both of your lists are affected by the clients suppression list and so when subscribers are unsubscribed from one list they are also unsubscribed from the other. You can stop this behaviour by changing the list unsubscribe behaviour as outlined in the above help topic.

Join 200,000 companies around the world that use Campaign Monitor to run email marketing campaigns that deliver results for their business.

Get started for free
1-888-533-8098