Compare commits

...

1 Commits

Author SHA1 Message Date
Rodney Figaro
651ad91be3 13046 - add exclusion list feature in mailjet 2017-04-21 18:33:22 +02:00
2 changed files with 44 additions and 0 deletions

View File

@ -148,4 +148,22 @@ class MailjetSyncApiClientV3 implements IMailjetSyncApiClient
"JobID" => $jobid
));
}
public function addInExclusionList($email)
{
return $this->client->contact(array(
"method" => 'PUT',
"isExcludedFromCampaigns" => true,
"ID" => $email
));
}
public function removeFromExclusionList($email)
{
return $this->client->contact(array(
"method" => 'PUT',
"isExcludedFromCampaigns" => false,
"ID" => $email
));
}
}

View File

@ -0,0 +1,26 @@
<?php
/**
* Permet de syncro des clients dans les contacts mailjet
*/
/*
$authorized_ip = array(
'88.163.22.99',
'90.63.178.63',
'127.0.0.1'
);
if (!in_array($_SERVER['REMOTE_ADDR'], $authorized_ip)) {
die('You are not allowed');
}
*/
die('script disable');
include(dirname(__FILE__).'/../../config/config.inc.php');
include(dirname(__FILE__).'/mailjet_sync.php');
$api_version = (Configuration::get('MAILJETSYNC_OLD_API') == true) ? 1 : 3;
$api_key = Configuration::get('MAILJETSYNC_API_KEY');
$api_secret = Configuration::get('MAILJETSYNC_SECRET_KEY');
$mj = MailjetSyncApiClientFactory::create($api_version, $api_key, $api_secret);
$adds = $mj->removeFromExclusionList('figaro+blocked@antadis.com');
var_dump($adds);