Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to send email with NativeMailerHandler in Laravel 8 #1661

Closed
julianphp opened this issue Apr 27, 2022 · 3 comments
Closed

Unable to send email with NativeMailerHandler in Laravel 8 #1661

julianphp opened this issue Apr 27, 2022 · 3 comments
Labels

Comments

@julianphp
Copy link

Monolog version 2
Laravel 8.x
Php 7.4

Hi, 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

'monolog' => [
            '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...

@Seldaek
Copy link
Owner

Seldaek commented May 3, 2022

I suspect the MAIL_* config from .env apply to the symfony/mailer.

You can try with #1663 see if it helps, by passing it the mailer transport..

@askuri
Copy link

askuri commented May 26, 2022

I have found a way to use Monolog with Symfony Mailer on Laravel 9: https://stackoverflow.com/a/72394752/11836707.

It's not the NativeMailHandler you tried to use, but SymfonyMailerHandler should do the job for you just as well.

@Seldaek
Copy link
Owner

Seldaek commented May 27, 2022

Yes the new SymfonyMailerHandler is the way to go IMO.

@Seldaek Seldaek closed this as completed May 27, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants