Sure but there's nothing unusial to it. I think the issue is elswhere. I'm quessing there's some issue with error handling wchich causes execution to stop wchich leads to event not being fired.
/// EventServiceProvider.php
protected $listen = [
'App\Events\Event' => [
'App\Listeners\EventListener',
],
'App\Events\UserDeleted' => [
'App\Listeners\UserDeleted',
],
'App\Events\CommentDeleted' => [
'App\Listeners\CommentDeleted',
],
NotificationFalied::class => [
NotificationFailedListener::class,
],
NotificationSending::class => [
NotificationSendingListener::class,
],
'App\Events\NewPostCreated' => [
'App\Listeners\CreateAdminAction'
],
'App\Events\PostStatusUpdated' => [
'App\Listeners\NotifyAdministrator'
]
];
/// NotificationFailedListener.php
<?php
namespace App\Notifications\Listeners;
use Illuminate\Notifications\Events\NotificationFailed;
use Log;
class NotificationFailedListener
{
public function handle(NotificationFailed $event)
{
Log::info('------------------ NOTIFICATION FAILED ');
}
}
When there's some issue while sending email
// error.log
Failed to authenticate on SMTP server with username "xxxxxxxxxxx" using 3 possible authenticators. Authenticator CRAM-MD5 returned Swift_TransportException: Expected response code 235 but got code "535", with message "535 5.7.0 Invalid login or password
IN ...\vendor\swiftmailer\swiftmailer\lib\classes\Swift\Transport\AbstractSmtpTransport.php:457
and no "NotificationFalied" event fired.