Skip to content

Commit 8b98426

Browse files
committed
updated readme file
1 parent 87d6e3d commit 8b98426

1 file changed

Lines changed: 29 additions & 1 deletion

File tree

README.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,30 @@
11
# dot-controller-plugin-mail
2-
Mail controller plugin for easy access of mail services inside DK controllers
2+
3+
Mail controller plugin for easy access to dot-mail service from any controller.
4+
5+
## Installation
6+
7+
Run the following command in your project's root directory
8+
```bash
9+
$ composer require dotkernel/dot-controller-plugin-mail
10+
```
11+
12+
This will also install packages `dotkernel/dot-controller` and `'dotkernel/dot-mail` as dependencies.
13+
Next, make sure you merge the `ConfigProvider` to your application's configuration.
14+
15+
## Usage
16+
17+
Because multiple mail services can be defined in the dot-mail module, there can also be requested as controller plugins by following the convention
18+
19+
```php
20+
$this->sendMail(); //will return the default mail service
21+
22+
$this->sendMailYourMailService(); //will return the mail service named your_mail_service
23+
```
24+
25+
Controller mail plugins are invokable. To send a mail you can use the following 2 methods
26+
27+
* `$this->sendMail(array $mailConfig)` - will send a mail through a mail service configured based on the $mailConfig param.
28+
The array parameter valid keys are body, subject, to, from, cc, bcc, attachments. The body parameter can be specified as an array too in which case the $body[0] should be the template name to use as mail template and $body[1] should be optionally the template parameters.
29+
30+
* `$this->sendMail($body, $subject, $to, $from, $cc, $bcc, $attachments)` - the parameters have the same meaning as in the previous method

0 commit comments

Comments
 (0)