From 9d9e3afba2054bfa23ba6f019b7c8885c2d8415e Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sat, 6 Jun 2015 14:10:31 -0400 Subject: Improve email sending system and add Postmark as mail transport --- app/Core/EmailClient.php | 43 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 app/Core/EmailClient.php (limited to 'app/Core/EmailClient.php') diff --git a/app/Core/EmailClient.php b/app/Core/EmailClient.php new file mode 100644 index 00000000..980f5acc --- /dev/null +++ b/app/Core/EmailClient.php @@ -0,0 +1,43 @@ +container['logger']->debug('Sending email to '.$email.' ('.MAIL_TRANSPORT.')'); + + $start_time = microtime(true); + $author = 'Kanboard'; + + if (Session::isOpen() && $this->userSession->isLogged()) { + $author = e('%s via Kanboard', $this->user->getFullname($this->session['user'])); + } + + switch (MAIL_TRANSPORT) { + case 'postmark': + $this->postmark->sendEmail($email, $name, $subject, $html, $author); + break; + default: + $this->smtp->sendEmail($email, $name, $subject, $html, $author); + } + + $this->container['logger']->debug('Email sent in '.round(microtime(true) - $start_time, 6).' seconds'); + } +} -- cgit v1.2.3