summaryrefslogtreecommitdiff
path: root/app/Core/Mail
diff options
context:
space:
mode:
Diffstat (limited to 'app/Core/Mail')
-rw-r--r--app/Core/Mail/Client.php31
1 files changed, 19 insertions, 12 deletions
diff --git a/app/Core/Mail/Client.php b/app/Core/Mail/Client.php
index 641b6abe..44f4753a 100644
--- a/app/Core/Mail/Client.php
+++ b/app/Core/Mail/Client.php
@@ -2,6 +2,7 @@
namespace Kanboard\Core\Mail;
+use Kanboard\Job\EmailJob;
use Pimple\Container;
use Kanboard\Core\Base;
@@ -46,23 +47,29 @@ class Client extends Base
public function send($email, $name, $subject, $html)
{
if (! empty($email)) {
- $this->logger->debug('Sending email to '.$email.' ('.MAIL_TRANSPORT.')');
-
- $start_time = microtime(true);
- $author = 'Kanboard';
+ $this->queueManager->push(EmailJob::getInstance($this->container)
+ ->withParams($email, $name, $subject, $html, $this->getAuthor())
+ );
+ }
- if ($this->userSession->isLogged()) {
- $author = e('%s via Kanboard', $this->helper->user->getFullname());
- }
+ return $this;
+ }
- $this->getTransport(MAIL_TRANSPORT)->sendEmail($email, $name, $subject, $html, $author);
+ /**
+ * Get email author
+ *
+ * @access public
+ * @return string
+ */
+ public function getAuthor()
+ {
+ $author = 'Kanboard';
- if (DEBUG) {
- $this->logger->debug('Email sent in '.round(microtime(true) - $start_time, 6).' seconds');
- }
+ if ($this->userSession->isLogged()) {
+ $author = e('%s via Kanboard', $this->helper->user->getFullname());
}
- return $this;
+ return $author;
}
/**