I am essentially using this code here: https://github.com/constantcontact/php-sdk/blob/development/examples/addOrUpdateContact.php Except I added a 3rd parameter for 'action_by' = 'ACTION_BY_VISITOR' I have two emails I am trying. One that's already in the system, and a new one. The one that's already in the system I can't update to change 'ACTION_BY_OWNER' to 'ACTION_BY_VISITOR'. When adding a new email, the response shows 'ACTION_BY_VISITOR' but the email still isn't being sent. What am I am missing? $optParams = array('action_by' => 'ACTION_BY_VISITOR');
if (isset($list) && isset($email) && strlen($email) > 1) {
try {
// check to see if a contact with the email address already exists in the account
$response = $cc->contactService->getContacts(ACCESS_TOKEN, array("email" => $email));
$contact = $response->results[0];
// create a new contact if one does not exist
if (empty($response->results)) {
$contact = new Contact();
$contact->addEmail($email);
$contact->addList($list->id);
$contact->first_name = $firstName;
$contact->last_name = $lastName;
$returnContact = $cc->contactService->addContact(ACCESS_TOKEN, $contact, $optParams);
} else {
//updating contact (adding to new list)
$contact = $response->results[0];
if ($contact instanceof Contact) {
$contact->addList($list->id);
$returnContact = $cc->contactService->updateContact(ACCESS_TOKEN, $contact, $optParams);
}
}
} catch(CtctException $ex) {
foreach ($ex->getErrors() as $error) {
error_log($error->error_message);
}
$msg['success'] = false;
$msg['msg'] = 'Error Subscribing';
}
... View more