No Mail sending after Update

Hi,
i updated from a 5.8.**-Version to the 5.12.6-W174-Version an now the Mail does’t go out.

I got this in my .env-File:

MAIL_MAILER=smtp
MAIL_HOST=mail.*******.de
MAIL_PORT=***
MAIL_USERNAME=info@*********.de
MAIL_PASSWORD=*********
MAIL_ENCRYPTION=SSL
MAIL_FROM_ADDRESS='info@************.de'
MAIL_FROM_NAME='*******'

and in my Desktop-App i got these settings:

Do i need both settings?

The Test-Mail was delivered and i got the E-Mail which says “E-Mail Server works”. But i can’t send a invoice.

This is the Error i got:

ErrorException: Trying to get property 'email' of non-object in /var/www/invoiceninja/app/Jobs/Mail/NinjaMailerJob.php:274
Stack trace:
#0 /var/www/invoiceninja/app/Jobs/Mail/NinjaMailerJob.php(274): Illuminate\Foundation\Bootstrap\HandleExceptions->handleError()
#1 /var/www/invoiceninja/app/Jobs/Mail/NinjaMailerJob.php(83): App\Jobs\Mail\NinjaMailerJob->preFlightChecksFail()
#2 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): App\Jobs\Mail\NinjaMailerJob->handle()
#3 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#4 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure()
#5 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod()
#6 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Container/Container.php(653): Illuminate\Container\BoundMethod::call()
#7 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(128): Illuminate\Container\Container->call()
#8 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\Bus\Dispatcher->Illuminate\Bus\{closure}()
#9 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#10 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(132): Illuminate\Pipeline\Pipeline->then()
#11 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(120): Illuminate\Bus\Dispatcher->dispatchNow()
#12 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(128): Illuminate\Queue\CallQueuedHandler->Illuminate\Queue\{closure}()
#13 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(103): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
#14 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(122): Illuminate\Pipeline\Pipeline->then()
#15 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(70): Illuminate\Queue\CallQueuedHandler->dispatchThroughMiddleware()
#16 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(98): Illuminate\Queue\CallQueuedHandler->call()
#17 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(428): Illuminate\Queue\Jobs\Job->fire()
#18 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(378): Illuminate\Queue\Worker->process()
#19 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(172): Illuminate\Queue\Worker->runJob()
#20 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(117): Illuminate\Queue\Worker->daemon()
#21 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(101): Illuminate\Queue\Console\WorkCommand->runWorker()
#22 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\Queue\Console\WorkCommand->handle()
#23 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Container/Util.php(40): Illuminate\Container\BoundMethod::Illuminate\Container\{closure}()
#24 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(93): Illuminate\Container\Util::unwrapIfClosure()
#25 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(37): Illuminate\Container\BoundMethod::callBoundMethod()
#26 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Container/Container.php(653): Illuminate\Container\BoundMethod::call()
#27 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Console/Command.php(136): Illuminate\Container\Container->call()
#28 /var/www/invoiceninja/vendor/symfony/console/Command/Command.php(298): Illuminate\Console\Command->execute()
#29 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Console/Command.php(121): Symfony\Component\Console\Command\Command->run()
#30 /var/www/invoiceninja/vendor/symfony/console/Application.php(1015): Illuminate\Console\Command->run()
#31 /var/www/invoiceninja/vendor/symfony/console/Application.php(299): Symfony\Component\Console\Application->doRunCommand()
#32 /var/www/invoiceninja/vendor/symfony/console/Application.php(171): Symfony\Component\Console\Application->doRun()
#33 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Console/Application.php(94): Symfony\Component\Console\Application->run()
#34 /var/www/invoiceninja/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(129): Illuminate\Console\Application->run()
#35 /var/www/invoiceninja/artisan(37): Illuminate\Foundation\Console\Kernel->handle()
#36 {main}

I hope you can help me, thanks in advance!

Hi,

The failed jobs may be old, I suggest running these commands to clear the queue to check for any new errors.

php artisan queue:flush
php artisan queue:clear

Yeah, i have done this:

Now my Queue looks like this:

Kings regards

I’d expect the failed count to be 0 after running the command. You can manually clear the jobs by emptying the failed_jobs table.

You may also want to try temporarily disabling the queue by changing to sync in the .env file.

You were right, the jobs are old:

I deleted them manually, and now it looks like this:

How can i temporarily disable the queue? in the .env-file it looks like this:

QUEUE_CONNECTION=database

Change it to QUEUE_CONNECTION=sync

Okay, and after that?

That’s it, try sending an email

Okay, and should I change back to

QUEUE_CONNECTION=database

or keep

QUEUE_CONNECTION=sync

?

Do you see a difference sending an email when it’s set to sync?

If i change it to “sync” and

sudo php8.4 artisan optimize

i got this:

What do you see when trying to email an invoice?

Yeah, Mail was send and delivered :+1:

But know, i have this warnings and errors :sweat_smile:

Using the queue would be faster, you can try re-enabling and get it working. Maybe the queue:work cron isn’t properly configured to process the queued jobs?

Okay, and do i have to change to

QUEUE_CONNECTION=database

or keep

QUEUE_CONNECTION=sync

?

Set it to database to enable the queue

If i changed it back to

QUEUE_CONNECTION=database

no Mails were delivered.

And i got Queue-Errors again:

Do i have to activate the cron after changing to database?

You need to setup the queue:work cron to process the queued jobs

I also checked the crontab, which was used before the update:

* * * * * php8.1 /var/www/pathtoinvoiceninja/artisan schedule:run >> /dev/null 2>&1

Is this still correct, and dont think so, right?

That’s schedule:run, you for the queue you also need queue:work