Make mail transports pluggable and move integrations to plugins

- Postmark: https://github.com/kanboard/plugin-postmark
- Mailgun: https://github.com/kanboard/plugin-mailgun
- Sendgrid: https://github.com/kanboard/plugin-sendgrid
This commit is contained in:
Frederic Guillot
2015-10-16 20:50:12 -04:00
parent 9c9ed02cd7
commit f99a3c501f
55 changed files with 652 additions and 1457 deletions

View File

@@ -3,6 +3,7 @@
namespace Kanboard\ServiceProvider;
use Kanboard\Core\Plugin\Loader;
use Kanboard\Core\Mail\Client as EmailClient;
use Kanboard\Core\ObjectStorage\FileStorage;
use Kanboard\Core\Paginator;
use Kanboard\Core\OAuth2;
@@ -78,7 +79,6 @@ class ClassProvider implements ServiceProviderInterface
'ProjectGanttFormatter',
),
'Core' => array(
'EmailClient',
'Helper',
'HttpClient',
'Lexer',
@@ -99,11 +99,7 @@ class ClassProvider implements ServiceProviderInterface
'GitlabWebhook',
'HipchatWebhook',
'Jabber',
'Mailgun',
'Postmark',
'Sendgrid',
'SlackWebhook',
'Smtp',
)
);
@@ -127,6 +123,14 @@ class ClassProvider implements ServiceProviderInterface
return new FileStorage(FILES_DIR);
};
$container['emailClient'] = function($container) {
$mailer = new EmailClient($container);
$mailer->setTransport('smtp', '\Kanboard\Core\Mail\Transport\Smtp');
$mailer->setTransport('sendmail', '\Kanboard\Core\Mail\Transport\Sendmail');
$mailer->setTransport('mail', '\Kanboard\Core\Mail\Transport\Mail');
return $mailer;
};
$container['pluginLoader'] = new Loader($container);
$container['cspRules'] = array('style-src' => "'self' 'unsafe-inline'", 'img-src' => '* data:');