protected function _isWhitelisted($recipient) { if (in_array($recipient, (array) $this->_recipient)) { return true; } foreach ($this->_whitelist as $pattern) { if (preg_match($pattern, $recipient)) { return true; } } return false; }