/**
* Remove the recipient
*/
protected function removeSubscriber()
{
$varInput = Idna::encodeEmail(Input::get('email', true));
// Validate e-mail address
if (!Validator::isEmail($varInput)) {
$_SESSION['UNSUBSCRIBE_ERROR'] = $GLOBALS['TL_LANG']['ERR']['email'];
$this->redirect($this->generateFrontendUrl($this->objModel->getRelated('jumpTo')->row()));
}
$objCleverReach = new CleverReach();
switch ($this->clr_unsubscribe) {
case 'inactive':
foreach ($this->clr_groups as $strGroupId) {
$objCleverReach->receiverSetInactive($varInput, $strGroupId);
}
break;
case 'delete':
foreach ($this->clr_groups as $strGroupId) {
$objCleverReach->receiverDelete($varInput, $strGroupId);
}
break;
case 'email':
default:
$objCleverReach->sendUnsubscribeMail($varInput, $this->clr_form);
break;
}
$this->redirect($this->generateFrontendUrl($this->objModel->getRelated('jumpTo')->row()));
}