Why is XML API not marking contact as Marketable

My developer is having problems getting emails set as marketable. This is the call he is using – can anyone see what’s wrong with it? Thanks Peter

// this is the bit that sets the optin value…

            $carray = array(
                php_xmlrpc_encode($this->key),                      
                php_xmlrpc_encode($contact['Email']), 
                php_xmlrpc_encode("newsletter subscriber"));
            
                $call = new xmlrpcmsg("APIEmailService.optIn", $carray);
                
                $result = $this->client->send($call);    
               
                return $contactId;
                                        
                          } else {
                                        
                                         return false;
                                        
                          }

@Peter_Harden
I don’t see anything that jumps out offhand, what is the actual value of $contact['Email'] ? is it an actual valid email address?

Yes, the variable is a valid email, and we are not having any problems adding the emails into the system. It is setting the marketing status that is proving a problem.

Can you not see in your logs why this is failing?

(Time lag in response due to being away for Easter hols).

Hi @Peter_Harden, is the email that you’re trying to opt in already in the application? If an email already exists or has ever existed in the system and has any status other than NonMarketable, you will not be able to opt it in via the API.

@Peter_Harden,

It works with the api wrapper so no reason the think there’s an issue with the underlying xml caller…soooo, the only condition which it should not work under is if the email was ever opted out. Note, emails are there own entity and even if you don’t have any contacts using the email, it’s status of opted out still remains. So if it’s re-used later or in anyway having been opted out, the api cannot opt it back in again, rather it must be opted in within the UI manually.