Created
September 18, 2014 12:27
-
-
Save chrisjimallen/46421a84c7eece11a0de to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$sendy = App::make('Hbsa\Api\Sendy\Connector'); | |
$list = MailingList::where('name','=',$contactData['list_name'])->first(); | |
$sendy->setListId($list->sendy_id); | |
$data = Array( | |
'name' => $contactData['first_name'], | |
'email' => $contactData['email_address'], | |
// 'email_address' => 'testingpost'.time().'@chrisjallen.com', | |
'Firstname' => $contactData['first_name'], | |
'Lastname' => $contactData['last_name'], | |
'Company' => $contactData['company'], | |
'Phone' => $contactData['phone_number'] | |
); | |
$result = $sendy->subscribe($data); | |
Log::info('Contact '.$job->contact_id.'('.$contactData['email_address'].') - Sendy', array('action' => $this->action)); | |
foreach($list->exclusions as $exclusion) { | |
// print_r($exclusion); | |
$sendy->setListId($exclusion->sendy_id); | |
$result = $sendy->unsubscribe($contactData['email_address']); | |
if($result['status']){ | |
Log::info('Contact '.$job->contact_id.'('.$contactData['email_address'].') - Sendy', array('action' => 'Unsubscribed from '.$exclusion->name)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment