added simplenews_spool management to try to fix mandrill rejected bug
This commit is contained in:
parent
923b407498
commit
c92d7ed737
@ -651,3 +651,29 @@ function materio_user_get_role_by_name($name) {
|
|||||||
return array_search($name, user_roles());
|
return array_search($name, user_roles());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Catch rejected email by mandrill, and remove them from simplenews lists
|
||||||
|
*
|
||||||
|
* @param array $result
|
||||||
|
* Associative array containing the send result, including the status.
|
||||||
|
*/
|
||||||
|
function materio_user_mandrill_mailsend_result($result) {
|
||||||
|
if ($result['status'] in_array(['rejected', 'invalid', 'error'])) {
|
||||||
|
// remove email from pool
|
||||||
|
simplenews_delete_spool(['mail'=>$result['email']]);
|
||||||
|
|
||||||
|
|
||||||
|
if ($result['status'] in_array(['invalid'])) {
|
||||||
|
// unsubscribe user if mail does not exists
|
||||||
|
$subscriber = simplenews_subscriber_load_by_mail($result['email']);
|
||||||
|
if ($subscriber) {
|
||||||
|
simplenews_subscriber_delete($subscriber);
|
||||||
|
}
|
||||||
|
// disable user
|
||||||
|
$user = user_load_by_mail($result['email']);
|
||||||
|
$user->status = 0;
|
||||||
|
user_save($user->uid);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user