Subscriber.Unsubscribe not working correctly

I am using the Subscriber.Unsubscribe method to remove users users from the client's subscriber list, but it is not working correctly.

As it is now, I have a page with a form field where the user enters their email address and then after clicking the 'Unsubscribe' button, it will unsubscribe that email address from the subscriber list. For some reason, that does not work. It will redirect the user to a confirmation page that I set up in my client settings, but it will not unsubscribe the user from the subscriber list. Ideally, I would like to have the user enter their email address and then it will send them an email with an unsubscribe link, so that no random person can enter your email address and unsubscribe you. Is that possible?

I am using the Subscriber.Add method perfectly and it is adding new users to my client's subscriber list here:

I am using the Unsubscribe method in PHP unsuccessfully here:

Here is the code I am using:

  $emailfield = $_POST["cm-juuujh-juuujh"];
  $api_key = 'MY API KEY';
  $client_id = null;
  $campaign_id = null;
  $list_id = 'CLIENT LIST ID';
  $cm = new CampaignMonitor( $api_key, $client_id, $campaign_id, $list_id );

  $result = $cm->subscriberUnsubscribe($emailfield);

<form action="" method="post">
    <label for="juuujh-juuujh" id="emailtitle">Email:</label><br /><input type="text" name="cm-juuujh-juuujh" id="juuujh-juuujh" /><br />
    <input type="submit" value="Unsubscribe" id="removefrommailer_submit" />

Mathew Mathew, 7 years ago


I think you already have contacted support, but if not, please do and one of our developers can take a look for you.

Get in touch with us on Twitter:
We're also on Facebook:
jamesd jamesd, 7 years ago


Your unsubscribe form has the action set to which I believe is your subscribe form. This looks to be your problem and is probably why your PHP code which calls the API is never called by your form.

You probably want to set the action of your form to something more like /cm/removefrommailer.php and configure that PHP script to react to the submission of the email address in your form.

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