From 8314c99b56e66c2b86dd32432bcf5ed94a3ece02 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Mon, 23 May 2016 20:43:51 -0400 Subject: Added QueueManager to process background jobs --- app/Job/EmailJob.php | 54 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 app/Job/EmailJob.php (limited to 'app/Job/EmailJob.php') diff --git a/app/Job/EmailJob.php b/app/Job/EmailJob.php new file mode 100644 index 00000000..9293a1d4 --- /dev/null +++ b/app/Job/EmailJob.php @@ -0,0 +1,54 @@ +jobParams = array($email, $name, $subject, $html, $author); + return $this; + } + + /** + * Execute job + * + * @access public + * @param string $email + * @param string $name + * @param string $subject + * @param string $html + * @param string $author + */ + public function execute($email, $name, $subject, $html, $author) + { + $this->logger->debug(__METHOD__.' Sending email to '.$email.' via '.MAIL_TRANSPORT); + $startTime = microtime(true); + + $this->emailClient + ->getTransport(MAIL_TRANSPORT) + ->sendEmail($email, $name, $subject, $html, $author) + ; + + if (DEBUG) { + $this->logger->debug('Email sent in '.round(microtime(true) - $startTime, 6).' seconds'); + } + } +} -- cgit v1.2.3