Skip to content

Commit d05d749

Browse files
committed
ICL: New readme section added.
1 parent 501fd02 commit d05d749

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,39 @@ class Foo extends Command
217217
}
218218
```
219219
220+
#### Notifications mail driver
221+
222+
In order to send an email notifications, package would check `mail` configuration of your Laravel project.
223+
If you're using one of supported mail drivers, it would be used for email notifications automatically. Supported drivers are: `mail`, `smtp`, `sendmail`, `mandrill`.
224+
If you're using something else, for example, `ses` or `sparkpost` - native PHP `mail()` function would be used as a driver.
225+
226+
Unfortunately, we're currently not supporting all of Laravel's mail drivers, because [Monolog email handlers](https://github.com/Seldaek/monolog/blob/master/doc/02-handlers-formatters-processors.md#send-alerts-and-emails) don't.
227+
Maybe in future other drivers would be supported too.
228+
229+
However, you can totally change this behaviour, by overriding `getMailerHandler` method:
230+
```php
231+
class Foo extends Command
232+
{
233+
use Loggable;
234+
235+
protected function getMailerHandler()
236+
{
237+
$mailer = app('my-swift-mailer');
238+
239+
$message = $mailer->createMessage();
240+
$message->setSubject('Hey! Something went wrong!');
241+
$message->setFrom(['[email protected]' => 'My Notification System']);
242+
$message->setTo(['[email protected]' => 'John Doe']);
243+
$message->setContentType('text/html');
244+
$message->setCharset('utf-8');
245+
246+
return new SwiftMailerHandler($mailer, $message);
247+
}
248+
249+
// ...
250+
}
251+
```
252+
220253
#### Accessing Monolog instance
221254

222255
This package is using [Monolog logging library](https://packagist.org/packages/monolog/monolog) with all of it's power and benefits.

0 commit comments

Comments
 (0)