Skip to content

Commit e286008

Browse files
authored
Check to ensure there are no invalid emails without recipient in queue (#1109)
1 parent 9f7d5b3 commit e286008

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

app/code/core/Mage/Core/Model/Email/Queue.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ protected function _afterSave()
9595
*/
9696
protected function _beforeSave()
9797
{
98-
if (empty($this->_recipients) || !is_array($this->_recipients)) {
98+
if (empty($this->_recipients) || !is_array($this->_recipients) || empty($this->_recipients[0])) { // additional check of recipients information (email address)
9999
Mage::throwException(Mage::helper('core')->__('Message recipients data must be set.'));
100100
}
101101
return parent::_beforeSave();
@@ -238,13 +238,13 @@ public function send()
238238

239239
try {
240240
$mailer->send();
241+
unset($mailer);
242+
$message->setProcessedAt(Varien_Date::formatDate(true));
243+
$message->save(); // save() is throwing exception when recipient is not set
241244
} catch (Exception $e) {
242245
Mage::logException($e);
243246
}
244247

245-
unset($mailer);
246-
$message->setProcessedAt(Varien_Date::formatDate(true));
247-
$message->save();
248248
}
249249
}
250250

0 commit comments

Comments
 (0)