Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
languagephp
themeRDark
titlePHP example
$contactsService = new com_maileon_api_contacts_ContactsService(array(
	'API_KEY' => '', // the API key acquired from Maileon/Settings/API keys
    'BASE_URI' => 'https://api.maileon.com/1.0'
));

$mailingId = ''; // optionally a Maileon mailing ID can be provided to attach this unsubscription to a specific mailing; this should be also added to the link above as required, e.g.: &mailingId=[MAILING|ID]
$reasons = array(
	'too_many_messages|my custom text'
); /** @see http://dev.maileon.com/api/rest-api-1-0/contacts/unsubscribe-contacts-by-email/ for all possible reasons*/

$response = $contactsService->unsubscribeContactByEmail($_GET['email'], $mailingId, $reasons);

if ($response->isSuccess()) {
	echo "<h1>Succesfully unsubscription</h1>";
}

...