Skip to content

Commit b8429cb

Browse files
committed
ACP2E-2734: Emails are failing to send
1 parent 375d870 commit b8429cb

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

app/code/Magento/Sales/Model/EmailSenderHandler.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ public function __construct(
105105

106106
/**
107107
* Handles asynchronous email sending
108+
*
108109
* @return void
109110
*/
110111
public function sendEmails()
@@ -137,6 +138,9 @@ public function sendEmails()
137138
'email_sent'
138139
);
139140
} else {
141+
// When the email is failed to send, the email_sent attribute
142+
// should be set to false, preventing this email from being
143+
// sent over and over again in the next cron runs.
140144
$this->entityResource->saveAttribute(
141145
$item->setEmailSent(false),
142146
'email_sent'

app/code/Magento/Sales/Test/Unit/Model/EmailSenderHandlerTest.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,12 @@ public function testExecute(
256256
->expects($this->once())
257257
->method('saveAttribute')
258258
->with($collectionItem);
259+
} else {
260+
$collectionItem
261+
->expects($this->once())
262+
->method('setEmailSent')
263+
->with(false)
264+
->willReturn($collectionItem);
259265
}
260266
}
261267
}

0 commit comments

Comments
 (0)