Permalink
Browse files

switch from using EmailComponent to just the CakeEmail class

  • Loading branch information...
1 parent 40b2f0e commit 73ffd256964fb7b96efca07903e292e76a05bdc2 @josegonzalez committed Dec 24, 2011
Showing with 14 additions and 9 deletions.
  1. +14 −9 Lib/Job/DeferredEmail.php
View
@@ -1,6 +1,7 @@
<?php
App::uses('CakeJob', 'CakeDjjob.Job');
App::uses('DJJob', 'Djjob.Vendor');
+App::uses('CakeEmail', 'Network/Email');
/**
* Deferred Email class
@@ -139,24 +140,19 @@ public function send() {
$this->_vars['sendAs'] = 'both';
}
+ $email = new CakeEmail();
try {
- $this->loadComponent('Email');
- $this->Email->_set($this->_vars);
+ $email->config($this->_vars);
if (isset($this->_vars['variables'])) {
- $this->_internals['controller']->set($this->_vars['variables']);
+ $email->viewVars($this->_vars['variables']);
}
- $this->_sent = $this->Email->send($this->_message);
+ $this->_sent = $email->send($this->_message);
} catch (Exception $e) {
$this->_sent = false;
$this->log($e->getMessage(), 'email');
$this->sendLater(date('Y-m-d H:i:s', strtotime("+1 minute")));
}
- $smtpError = $this->Email->smtpError;
- if (!empty($smtpError)) {
- $this->log($smtpError, 'email');
- }
-
return $this->_sent;
}
@@ -172,6 +168,15 @@ public function sendLater($send_at = null, $queue = "email") {
}
/**
+ * Gets the current variables
+ *
+ * @return array
+ */
+ public function getVars() {
+ return $this->_vars;
+ }
+
+/**
* Handles merging of current email variables, as well as setting
* public properties for later ease of usage
*

0 comments on commit 73ffd25

Please sign in to comment.