diff --git a/app/code/local/Aschroder/SMTPPro/Model/Email/Queue.php b/app/code/local/Aschroder/SMTPPro/Model/Email/Queue.php
index 8a2fe7b..c142064 100644
--- a/app/code/local/Aschroder/SMTPPro/Model/Email/Queue.php
+++ b/app/code/local/Aschroder/SMTPPro/Model/Email/Queue.php
@@ -9,6 +9,10 @@
*/
class Aschroder_SMTPPro_Model_Email_Queue extends Mage_Core_Model_Email_Queue {
+ protected $finalSMTPcodesForEmail = [
+ 401, 432, 441, 450, 510, 511, 512, 513, 521, 523, 530, 541, 550, 551, 553, 555
+ ];
+
// As per parent class - except addition of before and after send events
public function send()
{
@@ -123,10 +127,25 @@ public function send()
unset($mailer);
$oldDevMode = Mage::getIsDeveloperMode();
Mage::setIsDeveloperMode(true);
+
Mage::logException($e);
+
+ // if SMTP code not final for email, stop queue
+ if ($e instanceof Zend_Mail_Protocol_Exception &&
+ $transport->getTransport() instanceof Zend_Mail_Transport_Smtp &&
+ !in_array($e->getCode(), $this->finalSMTPcodesForEmail)
+ ) {
+ Mage::logException(new Exception('Email Queue was stopped with error code - ' . $e->getCode()));
+ Mage::setIsDeveloperMode($oldDevMode);
+ return false;
+ }
+
Mage::setIsDeveloperMode($oldDevMode);
- return false;
+ $message->setProcessedAt(Varien_Date::formatDate(true));
+ $message->save();
+
+ continue;
}
// after each valid message has been sent - pause if required
diff --git a/app/code/local/Aschroder/SMTPPro/Model/Email/Template.php b/app/code/local/Aschroder/SMTPPro/Model/Email/Template.php
index 923d5b4..6a3ce1a 100644
--- a/app/code/local/Aschroder/SMTPPro/Model/Email/Template.php
+++ b/app/code/local/Aschroder/SMTPPro/Model/Email/Template.php
@@ -76,6 +76,7 @@ public function send($email, $name = null, array $variables = array())
/** @var $emailQueue Mage_Core_Model_Email_Queue */
$emailQueue = $this->getQueue();
+ $emailQueue->clearRecipients();
$emailQueue->setMessageBody($text);
$emailQueue->setMessageParameters(array(
'subject' => $subject,
diff --git a/app/code/local/Aschroder/SMTPPro/etc/system.xml b/app/code/local/Aschroder/SMTPPro/etc/system.xml
index d81e468..25283b0 100644
--- a/app/code/local/Aschroder/SMTPPro/etc/system.xml
+++ b/app/code/local/Aschroder/SMTPPro/etc/system.xml
@@ -5,8 +5,8 @@
600
1
- 0
- 0
+ 1
+ 1
@@ -17,8 +17,8 @@
text
110
1
- 0
- 0
+ 1
+ 1
@@ -26,7 +26,7 @@
10
1
1
- 0
+ 1
SMTP Pro Email Extension Configure your SMTP connection below. If you have any questions or would like any help please visit magesmtppro.com.]]>
@@ -47,7 +47,7 @@
20
1
1
- 0
+ 1
@@ -58,7 +58,7 @@
23
1
1
- 0
+ 1
@@ -68,7 +68,7 @@
20
1
1
- 0
+ 1
@@ -79,7 +79,7 @@
23
1
1
- 0
+ 1
@@ -89,7 +89,7 @@
20
1
1
- 0
+ 1
@@ -100,7 +100,7 @@
23
1
1
- 0
+ 1
@@ -112,7 +112,7 @@
20
1
1
- 0
+ 1
@@ -123,7 +123,7 @@
23
1
1
- 0
+ 1
@@ -134,7 +134,7 @@
20
1
1
- 0
+ 1
@@ -143,7 +143,7 @@
23
1
1
- 0
+ 1
login,plain,crammd5
@@ -153,7 +153,7 @@
26
1
1
- 0
+ 1
login,plain,crammd5
@@ -162,7 +162,7 @@
29
1
1
- 0
+ 1
@@ -171,7 +171,7 @@
32
1
1
- 0
+ 1
@@ -182,7 +182,7 @@
35
1
1
- 0
+ 1