Limit number of confirmation emails sent to one email
MAILPOET-1734
This commit is contained in:
@@ -10,6 +10,8 @@ use MailPoet\Util\Helpers;
|
||||
|
||||
class ConfirmationEmailMailer {
|
||||
|
||||
const MAX_CONFIRMATION_EMAILS = 3;
|
||||
|
||||
/** @var Mailer */
|
||||
private $mailer;
|
||||
|
||||
@@ -29,6 +31,12 @@ class ConfirmationEmailMailer {
|
||||
return false;
|
||||
}
|
||||
|
||||
$subscriber->count_confirmations++;
|
||||
$subscriber->save();
|
||||
if(!is_user_logged_in() && $subscriber->count_confirmations > self::MAX_CONFIRMATION_EMAILS) {
|
||||
return false;
|
||||
}
|
||||
|
||||
$segments = $subscriber->segments()->findMany();
|
||||
$segment_names = array_map(function($segment) {
|
||||
return $segment->name;
|
||||
|
Reference in New Issue
Block a user