summaryrefslogtreecommitdiff
path: root/doc/es_ES/plugin-mail-transports.markdown
blob: 1d999c81ade6d13917f7e9edb78f98f464454642 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
Plugin: Agregar trasporte de email
==================================

Por default Kanboard soporta 3 estadares de trasporte de email:

- Mail (PHP mail function)
- Smtp
- Sendmail command

Con la API del plugin tu puedes agregar un driver para cualquier proveedor de email.
Por ejemplo, nuestro plugin puede agregar un trasporte de email para un proveedor que usa un API HTTP.

Implementación
--------------

Nuestro plugin dede implementgar la interface `Kanboard\Core\Mail\ClientInterface` y extiende desde `Kanboard\Core\Base`.
El único método que necesita para implementar es `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);
}
```

Para registrar el nuevo trasporte de email, usa el metodo `setTransport($transport, $class)` desde la clase `Kanboard\Core\Mail\Client`:

```php
$this->emailClient->setTransport('myprovider', '\Kanboard\Plugin\MyProvider\MyEmailHandler');
```

EL segundo argumento contiene el absoluto namespace de tu clase especifica

Ejemplos de plugins para trasporte de email
----------------------------------

- [Sendgrid](https://github.com/kanboard/plugin-sendgrid)
- [Mailgun](https://github.com/kanboard/plugin-mailgun)
- [Postmark](https://github.com/kanboard/plugin-postmark)