Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 13 additions & 7 deletions app/code/Magento/Newsletter/Model/Subscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -604,14 +604,20 @@ protected function _updateCustomerSubscription($customerId, $subscribe)

$this->save();
$sendSubscription = $sendInformationEmail;
if ($sendSubscription === null xor $sendSubscription) {
if ($sendSubscription === null xor $sendSubscription && $this->isStatusChanged()) {
try {
if ($isConfirmNeed) {
$this->sendConfirmationRequestEmail();
} elseif ($this->isStatusChanged() && $status == self::STATUS_UNSUBSCRIBED) {
$this->sendUnsubscriptionEmail();
} elseif ($this->isStatusChanged() && $status == self::STATUS_SUBSCRIBED) {
$this->sendConfirmationSuccessEmail();
switch ($status) {
case self::STATUS_UNSUBSCRIBED:
$this->sendUnsubscriptionEmail();
break;
case self::STATUS_SUBSCRIBED:
$this->sendConfirmationSuccessEmail();
break;
case self::STATUS_NOT_ACTIVE:
if ($isConfirmNeed) {
$this->sendConfirmationRequestEmail();
}
break;
}
} catch (MailException $e) {
// If we are not able to send a new account email, this should be ignored
Expand Down