Unsubscribe method not working
Closed this issue · 3 comments
MarlonEtiene commented
When I try this
if ($mc->check($listId, $customer->email)) {
$mc->unsubscribe($listId, $customer->email);
}
I got this error
'type' => 'http://developer.mailchimp.com/documentation/mailchimp/guides/error-glossary/',
'title' => 'Member Exists',
'status' => 400,
'detail' => 'email@email.com is already a list member. Use PUT to insert or update list members.',
'instance' => '0e6eaa47-cb6f-47d8-9530-8c69740de3d2',
The email@email.com have status = 'subscribed' and I think I can call unsubscribe method to unsubscribe
this member, is this correct?
Can you help me?
nztim commented
Please give this a try:
if ($mc->check($listId, strtolower($customer->email))) {
$mc->unsubscribe($listId, strtolower($customer->email));
}
MarlonEtiene commented
@nztim this worked like a charm!
Thank you!
nztim commented
Great :)
It's because the unsubscribe method didn't take care of lowercasing the email address before hashing it.
If you update to the latest version (v3.8) your original code should work.