| | <?php |
| |
|
| | namespace Kanboard\Core\Mail; |
| |
|
| | use Kanboard\Job\EmailJob; |
| | use Pimple\Container; |
| | use Kanboard\Core\Base; |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | class Client extends Base |
| | { |
| | |
| | |
| | |
| | |
| | |
| | |
| | private $transports; |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | public function __construct(Container $container) |
| | { |
| | parent::__construct($container); |
| | $this->transports = new Container; |
| | } |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | public function send($recipientEmail, $recipientName, $subject, $html, $authorName = null, $authorEmail = null) |
| | { |
| | if (! empty($recipientEmail)) { |
| | $this->queueManager->push(EmailJob::getInstance($this->container)->withParams( |
| | $recipientEmail, |
| | $recipientName, |
| | $subject, |
| | $html, |
| | is_null($authorName) ? $this->getAuthorName() : $authorName, |
| | is_null($authorEmail) ? $this->getAuthorEmail() : $authorEmail |
| | )); |
| | } |
| |
|
| | return $this; |
| | } |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | public function getAuthorName() |
| | { |
| | $author = 'Kanboard'; |
| |
|
| | if ($this->userSession->isLogged()) { |
| | $author = e('%s via Kanboard', $this->helper->user->getFullname()); |
| | } |
| |
|
| | return $author; |
| | } |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | public function getAuthorEmail() |
| | { |
| | if ($this->userSession->isLogged()) { |
| | $userData = $this->userSession->getAll(); |
| | return ! empty($userData['email']) ? $userData['email'] : ''; |
| | } |
| |
|
| | return ''; |
| | } |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | public function getTransport($transport) |
| | { |
| | return $this->transports[$transport]; |
| | } |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | public function setTransport($transport, $class) |
| | { |
| | $container = $this->container; |
| |
|
| | $this->transports[$transport] = function () use ($class, $container) { |
| | return new $class($container); |
| | }; |
| |
|
| | return $this; |
| | } |
| |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | public function getAvailableTransports() |
| | { |
| | $availableTransports = $this->transports->keys(); |
| | return array_combine($availableTransports, $availableTransports); |
| | } |
| | } |
| |
|