API Unsubscribe returns "Bad Email Address"

Anytime I try to unsubscribe a user via the SOAP API I get this error:

<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<Subscriber.UnsubscribeResponse xmlns="http://api.createsend.com/api/">
<Subscriber.UnsubscribeResult>
<Code>1</Code>
<Message>Invalid Email Address</Message>
</Subscriber.UnsubscribeResult>
</Subscriber.UnsubscribeResponse>
</soap:Body>
</soap:Envelope>

The email address I'm unsubscribing is 100% valid, anyone have any ideas? I contacted support but haven't heard back...

Ben Ben, 7 years ago

Hi Sirus,

We haven't seen your support request come in but I can help from here. Can you post the code you are using to call the API so we can try to spot the problem?

sirius, 7 years ago

this is the soap command I'm sending:

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
    <soap:Body>
        <Subscriber.Unsubscribe xmlns="http://api.createsend.com/api/">
              <ApiKey>api key is here</ApiKey>
              <ListID>lsit id is here </ListID>
              <EmailAddress>email is here</EmailAddress>
        </Subscriber.Unsubscribe>
    </soap:Body>
</soap:Envelope>

I send other commands and they work fine, it's just this one.

I'm using a bunch of custom functions to send it, but this simplified code returns the same thing:

<%

deleteXML = "<?xml version=""1.0"" encoding=""utf-8""?>" &_
"<soap:Envelope xmlns:xsi=""http://www.w3.org/2001/XMLSchema-instance"" xmlns:xsd=""http://www.w3.org/2001/XMLSchema"" xmlns:soap=""http://schemas.xmlsoap.org/soap/envelope/"">" &_
"    <soap:Body>" &_
"        <Subscriber.Unsubscribe xmlns=""http://api.createsend.com/api/"">" &_
"              <ApiKey>api</ApiKey>" &_
"              <ListID>listid</ListID>" &_
"              <EmailAddress>email</EmailAddress>" &_
"        </Subscriber.Unsubscribe>" &_
"    </soap:Body>" &_
"</soap:Envelope>"

dim xmlHttp
Set xmlHttp = Server.CreateObject("Microsoft.xmlhttp")
xmlHttp.open "POST","http://api.createsend.com/api/api.asmx" ,false
xmlHttp.setRequestHeader "Content-Type", "text/xml; charset=utf-8"

xmlHttp.setRequestHeader "SOAPAction", "http://api.createsend.com/api/Subscriber.Unsubscribe"
xmlHttp.send deleteXML

response.write xmlHttp.responseText

set xmlHttp = Nothing

%>
sirius, 7 years ago

No Ideas?

Phil Phil, 7 years ago

Hi sirius,

Apologies for the delay in addressing this, especially since it's an easy problem to fix (but annoyingly hard to spot!).

The problem is that Subscriber.Unsubscribe is expecting an argument called Email, but you're sending through a parameter called EmailAddress. If you fix that you should find the code works as expected. If not, send us through a support request
and we'll take another look there.

sirius, 7 years ago

Ok, that worked... thanks.

Now my only trouble is that during testing my form I unsubscribe my test email through the API, then resign it up through the createsend.com interface, then try and update the settings via the API, it says the user is in the unsubscribe list and I can't update it. So now I can't test my the form I'm creating. What is weird is if I use Subscribers.GetSingleSubscriber to get these accounts, they say they are subscribed, but when I Subscriber.AddWithCustomFields to update the settings it says they are unsubscribed.... does it take time to reset the user back?

sirius, 7 years ago

Okay, this is annoying. I'm testing scripts that update/unsubscribe people using about 3 different emails. If I unsubscribe them, then re-activate them using the CM website, after a couple times when I try and update the info, they give an error saying that they are unsubscribed, when in the CM website they say active, and when I return Subscribers.GetSingleSubscriber, it says it's Active. I can't test my scripts anymore without creating more and more throwaway email address... please help!

Ken Ken, 7 years ago

That's weird. You shouldn't be getting contradicting results from the API and from the Campaign Monitor website. Could you send a email to support@campaignmonitor.com with your account details, and the list you're working on, and ask for me (Ken), and then I can look further into what the problem might be.


http://www.campaignmonitor.com

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