'Laravel Loggin send email with monolog NativeMailerHandler

I'm trying to use a laravel logging channel to send an email with the error, but I can't get anything to be sent, I'm trying with monolog and NativeMailerHandler but I still can't send anything, Laravel 8 and php 7.4:

config/logging.php

            'driver' => 'monolog',
            'handler' =>\Monolog\Handler\NativeMailerHandler::class,
            'level' => 'debug',
            'with' => [
                'to' => '[email protected]',
                'from' => '[email protected]',
                'subject' => 'test',
                'level' => 'debug'
            ],

Call from a controller

 Log::channel('monologmail')->debug('test');

In the .env i have the mails settings:

MAIL_MAILER=smtp
MAIL_HOST=smtp.gmail.com
MAIL_PORT=465
[email protected]
MAIL_PASSWORD=password
MAIL_ENCRYPTION=ssl
[email protected]

It simply does not send any message, nor does it give any error or anything...



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source