summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2015-10-16 21:16:25 -0400
committerFrederic Guillot <fred@kanboard.net>2015-10-16 21:16:25 -0400
commit59b614605f15e00aea660c344c04a238e65ba4ab (patch)
treed8b495d9c459132df4dd9648a6145a5270a6a087
parentf99a3c501fd6ed7b4914b8d6e855489c2ce5b219 (diff)
Add documentation to add new mail transports
-rw-r--r--doc/plugin-mail-transports.markdown50
-rw-r--r--doc/plugins.markdown9
2 files changed, 55 insertions, 4 deletions
diff --git a/doc/plugin-mail-transports.markdown b/doc/plugin-mail-transports.markdown
new file mode 100644
index 00000000..cb7dd6ce
--- /dev/null
+++ b/doc/plugin-mail-transports.markdown
@@ -0,0 +1,50 @@
+Plugin: Add Mail Transport
+==========================
+
+By default Kanboard supports 3 standards mail transports:
+
+- Mail (PHP mail function)
+- Smtp
+- Sendmail command
+
+With the plugin API you can add a driver for any email provider.
+By example, your plugin can add a mail transport for a provider that uses an HTTP API.
+
+Implementation
+--------------
+
+Your plugin must implements the interface `Kanboard\Core\Mail\ClientInterface` and extends from `Kanboard\Core\Base`.
+
+The only method you need to implement is `sendEmail()`:
+
+```php
+interface ClientInterface
+{
+ /**
+ * Send a HTML email
+ *
+ * @access public
+ * @param string $email
+ * @param string $name
+ * @param string $subject
+ * @param string $html
+ * @param string $author
+ */
+ public function sendEmail($email, $name, $subject, $html, $author);
+}
+```
+
+To register your new mail transport, use the method `setTransport($transport, $class)` from the class `Kanboard\Core\Mail\Client`:
+
+```php
+$this->emailClient->setTransport('myprovider', '\Kanboard\Plugin\MyProvider\MyEmailHandler');
+```
+
+The second argument contains the absolute namespace of your concrete class.
+
+Examples of mail transport plugins
+----------------------------------
+
+- [Sendgrid](https://github.com/kanboard/plugin-sendgrid)
+- [Mailgun](https://github.com/kanboard/plugin-mailgun)
+- [Postmark](https://github.com/kanboard/plugin-postmark)
diff --git a/doc/plugins.markdown b/doc/plugins.markdown
index a0f389e0..39a1caec 100644
--- a/doc/plugins.markdown
+++ b/doc/plugins.markdown
@@ -7,10 +7,11 @@ Plugins are useful to extend the core functionalities of Kanboard, adding featur
Plugin creators should specify explicitly the compatible versions of Kanboard. Internal code of Kanboard may change over the time and your plugin must be tested with new versions.
-- [Plugin Registration](plugin-registration.markdown)
-- [Plugin Hooks](plugin-hooks.markdown)
-- [Plugin Overrides](plugin-overrides.markdown)
-- [Plugin Schema Migrations](plugin-schema-migrations.markdown)
+- [Creating your plugin](plugin-registration.markdown)
+- [Using plugin hooks](plugin-hooks.markdown)
+- [Override default application behaviors](plugin-overrides.markdown)
+- [Add schema migrations for plugins](plugin-schema-migrations.markdown)
+- [Add mail transports](plugin-mail-transports.markdown)
Examples of plugins
-------------------