From dfd697b68ae3fb8b9bd5bfe946a1a331598de372 Mon Sep 17 00:00:00 2001 From: igorppbr Date: Tue, 8 Nov 2016 21:34:33 -0200 Subject: [PATCH] Use STMP Pro Extension With this commit you can use the SMTP Pro to send the emails in e marketing extension. --- src/module/Model/Outbox/Email.php | 11 ++++-- src/module/Model/Outbox/Transporter.php | 50 +++++++++++++++---------- src/module/etc/config.xml | 2 +- 3 files changed, 38 insertions(+), 25 deletions(-) diff --git a/src/module/Model/Outbox/Email.php b/src/module/Model/Outbox/Email.php index 780bbf9..4069f7f 100644 --- a/src/module/Model/Outbox/Email.php +++ b/src/module/Model/Outbox/Email.php @@ -9,7 +9,7 @@ * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/osl-3.0.php * - * @version {{version}} + * @version 0.4.10 * @category Mzax * @package Mzax_Emarketing * @author Jacob Siefer (jacob@mzax.de) @@ -584,10 +584,13 @@ protected function _prepareTransporter() $store = $this->getCampaign()->getStore(); $transporter = Mage::getStoreConfig('mzax_emarketing/email/transporter', $store); + + $isSMTPpro = Mage::getStoreConfig('mzax_emarketing/email/use_smtppro', $store); + if($isSMTPpro==1) + $transporter = "smtpro"; + $transporter = Mage::getSingleton('mzax_emarketing/outbox_transporter')->factory($transporter); - $transporter->setup($this); - - + $wrapper = new Varien_Object(); $wrapper->setTransporter($transporter); Mage::dispatchEvent('mzax_emarketing_email_prepare_transport', array( diff --git a/src/module/Model/Outbox/Transporter.php b/src/module/Model/Outbox/Transporter.php index ea0f9c2..d46805a 100644 --- a/src/module/Model/Outbox/Transporter.php +++ b/src/module/Model/Outbox/Transporter.php @@ -9,7 +9,7 @@ * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/osl-3.0.php * - * @version {{version}} + * @version 0.4.10 * @category Mzax * @package Mzax_Emarketing * @author Jacob Siefer (jacob@mzax.de) @@ -33,27 +33,37 @@ class Mzax_Emarketing_Model_Outbox_Transporter */ public function factory($name) { - $config = $this->getConfig(); - if(!isset($config->$name)) { - throw new Exception("No such email transporter found ({$name})"); - } - $config = $config->$name; - - - $transporterClass = $config->getClassName(); - - if(!class_exists($transporterClass)) { - throw new Exception("Email transporter config found, but model ($transporterClass) was not found"); + + //Se não for pra disparar pelo SMTP PRO + if($name!="smtpro") { + + $config = $this->getConfig(); + + if (!isset($config->$name)) { + throw new Exception("No such email transporter found ({$name})"); + } + $config = $config->$name; + + $transporterClass = $config->getClassName(); + + if (!class_exists($transporterClass)) { + throw new Exception("Email transporter config found, but model ($transporterClass) was not found"); + } + + /* @var $transporter Mzax_Emarketing_Model_Outbox_Transporter_Interface */ + $transporter = new $transporterClass; + + if (!$transporter instanceof Mzax_Emarketing_Model_Outbox_Transporter_Interface) { + throw new Exception("Email transporter '{$name}' must implement 'Mzax_Emarketing_Model_Outbox_Email_Transporter_Interface'"); + } + + return $transporter; } - - /* @var $transporter Mzax_Emarketing_Model_Outbox_Transporter_Interface */ - $transporter = new $transporterClass; - - if(!$transporter instanceof Mzax_Emarketing_Model_Outbox_Transporter_Interface) { - throw new Exception("Email transporter '{$name}' must implement 'Mzax_Emarketing_Model_Outbox_Email_Transporter_Interface'"); + else{ + $helperSMTP = Mage::helper('smtppro/data'); + $transporter = $helperSMTP->getTransport(); + return $transporter; } - - return $transporter; } diff --git a/src/module/etc/config.xml b/src/module/etc/config.xml index 2bf6072..2c85255 100644 --- a/src/module/etc/config.xml +++ b/src/module/etc/config.xml @@ -10,7 +10,7 @@ * It is also available through the world-wide-web at this URL: * http://opensource.org/licenses/osl-3.0.php * - * @version {{version}} + * @version 0.4.10 * @category Mzax * @package Mzax_Emarketing * @author Jacob Siefer (jacob@mzax.de)