public function send() { $_helper = Mage::helper('smtppro'); // If it's not enabled, just return the parent result. if (!$_helper->isEnabled()) { return parent::send(); } if (Mage::getStoreConfigFlag('system/smtp/disable')) { return $this; } $mail = new Zend_Mail(); if (strtolower($this->getType()) == 'html') { $mail->setBodyHtml($this->getBody()); } else { $mail->setBodyText($this->getBody()); } $mail->setFrom($this->getFromEmail(), $this->getFromName())->addTo($this->getToEmail(), $this->getToName())->setSubject($this->getSubject()); $transport = new Varien_Object(); // for observers to set if required Mage::dispatchEvent('aschroder_smtppro_before_send', array('mail' => $mail, 'email' => $this, 'transport' => $transport)); if ($transport->getTransport()) { // if set by an observer, use it $mail->send($transport->getTransport()); } else { $mail->send(); } Mage::dispatchEvent('aschroder_smtppro_after_send', array('to' => $this->getToName(), 'subject' => $this->getSubject(), 'template' => "n/a", 'html' => strtolower($this->getType()) == 'html', 'email_body' => $this->getBody())); return $this; }
public function send() { if (!Mage::getStoreConfig('amsmtp/general/enable')) { return parent::send(); } if (Mage::getStoreConfigFlag('system/smtp/disable')) { return $this; } Mage::helper('amsmtp')->debug('Ready to send e-mail at amsmtp/core_email::send()'); $mail = new Zend_Mail(); if (strtolower($this->getType()) == 'html') { $mail->setBodyHtml($this->getBody()); } else { $mail->setBodyText($this->getBody()); } $mail->setFrom($this->getFromEmail(), $this->getFromName())->addTo($this->getToEmail(), $this->getToName())->setSubject($this->getSubject()); $logId = Mage::helper('amsmtp')->log(array('subject' => $this->getSubject(), 'body' => $this->getBody(), 'recipient_name' => $this->getToName(), 'recipient_email' => $this->getToEmail(), 'template_code' => 'none', 'status' => Amasty_Smtp_Model_Log::STATUS_PENDING)); try { $transportFacade = Mage::getModel('amsmtp/transport'); if (!Mage::getStoreConfig('amsmtp/general/disable_delivery')) { $mail->send($transportFacade->getTransport()); } else { Mage::helper('amsmtp')->debug('Actual delivery disabled under settings.'); } Mage::helper('amsmtp')->logStatusUpdate($logId, Amasty_Smtp_Model_Log::STATUS_SENT); Mage::helper('amsmtp')->debug('E-mail sent successfully at amsmtp/core_email::send().'); } catch (Exception $e) { Mage::helper('amsmtp')->logStatusUpdate($logId, Amasty_Smtp_Model_Log::STATUS_FAILED); Mage::helper('amsmtp')->debug('Error sending e-mail: ' . $e->getMessage()); } return $this; }
public function send() { // If it's not enabled, just return the parent result. if (!Mage::helper('smtppro')->isEnabled()) { return parent::send(); } Mage::log('SMTPPro is enabled, sending email in Aschroder_SMTPPro_Model_Email'); // The remainder of this function closely mirrors the parent // method except for providing the SMTP auth details from the // configuration. This is not good OO, but the parent class // leaves little room for useful subclassing. if (Mage::getStoreConfigFlag('system/smtp/disable')) { return $this; } $mail = new Zend_Mail(); if (strtolower($this->getType()) == 'html') { $mail->setBodyHtml($this->getBody()); } else { $mail->setBodyText($this->getBody()); } $transport = Mage::helper('smtppro')->getTransport(); $dev = Mage::helper('smtppro')->getDevelopmentMode(); if ($dev == "contact") { $email = Mage::getStoreConfig('contacts/email/recipient_email'); Mage::log("Development mode set to send all emails to contact form recipient: " . $email); } elseif ($dev == "supress") { Mage::log("Development mode set to supress all emails."); # we bail out, but report success return $this; } else { // We just set the outgoing email as normal $email = $this->getToEmail(); } $mail->setFrom($this->getFromEmail(), $this->getFromName())->addTo($email, $this->getToName())->setSubject($this->getSubject()); // If we are using store emails as reply-to's set the header if (Mage::helper('smtppro')->isReplyToStoreEmail()) { // Later versions of Zend have a method for this, and disallow direct header setting... if (method_exists($mail, "setReplyTo")) { $mail->setReplyTo($this->getSenderEmail(), $this->getSenderName()); } else { $mail->addHeader('Reply-To', $this->getSenderEmail()); } Mage::log('ReplyToStoreEmail is enabled, just set Reply-To header: ' . $this->getSenderEmail()); } Mage::log('About to send email'); $mail->send($transport); Mage::log('Finished sending email'); $body = $this->getBody(); Mage::dispatchEvent('smtppro_email_after_send', array('to' => $this->getToName(), 'subject' => $this->getSubject(), 'template' => "n/a", 'html' => strtolower($this->getType()) == 'html', 'email_body' => $body)); return $this; }
/** * wraps send() method of parent, supplies before and after events, and * sends if allowed * @return $this|bool */ public function send() { if (!Mage::getStoreConfigFlag('hackathon_mailguard/settings/active')) { return parent::send(); } else { $return = FALSE; Mage::dispatchEvent('email_send_before', array('email' => $this, 'email_to' => $this->getToEmail())); if (!$this->getDoNotSend()) { $return = parent::send(); // TODO: Change the autogenerated stub } Mage::dispatchEvent('email_send_after', array('email' => $this, 'email_to' => $this->getToEmail())); return $return; } }
public function send() { if (!Mage::helper('ddg_transactional')->isEnabled()) { return parent::send(); } if (Mage::getStoreConfigFlag('system/smtp/disable')) { return $this; } $mail = new Zend_Mail(); if (strtolower($this->getType()) == 'html') { $mail->setBodyHtml($this->getBody()); } else { $mail->setBodyText($this->getBody()); } $mail->setFrom($this->getFromEmail(), $this->getFromName())->addTo($this->getToEmail(), $this->getToName())->setSubject($this->getSubject()); $transport = Mage::helper('ddg_transactional')->getTransport(); $mail->send($transport); return $this; }