public function SendinblueManager::validationEmail in SendinBlue 8
Same name and namespace in other branches
- 8.2 src/SendinblueManager.php \Drupal\sendinblue\SendinblueManager::validationEmail()
Check the email address of subscriber.
Parameters
string $email: An email address.
string $list_id: A list id.
Return value
array A response information.
File
- src/
SendinblueManager.php, line 581
Class
- SendinblueManager
- Basic manager of module.
Namespace
Drupal\sendinblueCode
public function validationEmail($email, $list_id) {
$contactInfo = $this->sendinblueMailin
->getUser($email);
if ($contactInfo === NULL) {
$ret = [
'code' => 'success',
'listid' => [],
];
return $ret;
}
$listId = $contactInfo
->getListIds();
if ($contactInfo
->isEmailBlacklisted()) {
$ret = [
'code' => 'update',
'listid' => $listId,
];
}
else {
if (!in_array($list_id, $listId)) {
$ret = [
'code' => 'success',
'listid' => $listId,
];
}
else {
$ret = [
'code' => 'already_exist',
'listid' => $listId,
];
}
}
return $ret;
}