Emails aren't sending after upgrade to v5.5

I upgraded to PHP 8.1 and Invoice Ninja v5.5.24-C93. Everything seems to be working but when I create and send an invoice it says “Succesfully queued invoice to be sent” but emails are not being sent.

I have debug enabled but I’m not seeing anything relevant to emails.

This is the most recent error: [2022-09-30 18:41:28] production.ERROR: file_get_contents(/usr/share/nginx/invoiceninja/vendor/beganovich/snappdf/versions/revision.txt): Failed to open stream: No such file or directory {“userId”:1,“exception”:"$
[stacktrace]

Also if I manually run: php artisan schedule:run >> /usr/share/nginx/invoiceninja/storage/logs/laravel.log 2>&1
I get: INFO No scheduled commands are ready to run.

@danoldlib

Can you try running

vendor/bin/snappdf download

I’m using the hosted_ninja for pdf generation so I’m not sure if the snappdf error is relevant to the emails not sending.

I did run vendor/bin/snappdf download and chown www-data:www-data. Emails still aren’t sending.

I’ve also tried switching QUEUE_CONNECTION from ‘sync’ to ‘database’ which didn’t make a difference.

Also I saw an older thread that mentioned removing quotes around MAIL_PASSWORD and that didn’t change anything.

Emails were sending fine prior to updating to v5.5

Thanks for your help.

This is the most recent error: [2022-09-30 18:41:28] production.ERROR: file_get_contents(/usr/share/nginx/invoiceninja/vendor/beganovich/snappdf/versions/revision.txt): Failed to open stream: No such file or directory {“userId”:1,“exception”:"$

This one definitely means the system is trying to use snappdf

you could try running this:

sudo -u www-data php artisan queue:listen

If you see a bunch of jobs starting to fire, it means your queue is not running.

I ran sudo -u www-data php artisan queue:listen - didn’t see any jobs at all.

I did switch to snappdf in my .env to see if that changed anything.

The listener should stay open… then try running a email out…

if nothing, check your system logs on the dashboard and recheck for any errors in storage/logs/laravel.log

Yeah I tried sending a few emails out with artisan queue:listen running and didn’t see anything.

No relevant errors in system logs on the dashboard and no errors in laravel.log

Does this part of my .env look correct?

BROADCAST_DRIVER=log
LOG_CHANNEL=stack
CACHE_DRIVER=file
QUEUE_CONNECTION=sync
SESSION_DRIVER=file
SESSION_LIFETIME=120

REDIS_HOST=127.0.0.1
REDIS_PASSWORD=null
REDIS_PORT=6379

MAIL_MAILER=smtp
MAIL_HOST=mail.monocacycoffee.com
MAIL_PORT=465
MAIL_USERNAME="info@monocacycoffee.com"
MAIL_PASSWORD=“MYPASSWORD”
MAIL_ENCRYPTION=ssl
MAIL_FROM_ADDRESS="orders@monocacycoffee.com"
MAIL_FROM_NAME=“Monocacy Coffee Co.”

Also this is what I have in www-data crontab - * * * * * php /usr/share/nginx/invoiceninja/artisan schedule:run >> /dev/null 2>&1

Not sure if this helps at all?

Are you running

php artisan optimize

after updating your .env file?

Yes running sudo -u www-data php artisan optimize

So when I have QUEUE_CONNECTION set to database I get jobs showing up with artisan queue:listen
They show up like this when I send an email:

INFO Processing jobs from the [default] queue.

2022-10-01 19:49:18 App\Jobs\Entity\EmailEntity … 2,903.34ms DONE
2022-10-01 19:49:22 App\Listeners\Invoice\InvoiceEmailActivity 1,243.11ms DONE
2022-10-01 19:49:24 App\Listeners\Invoice\InvoiceEmailedNotification 66.01ms DONE
2022-10-01 19:49:24 App\Listeners\Mail\MailSentListener … 18.00ms DONE
2022-10-01 19:49:24 App\Jobs\Mail\NinjaMailerJob … 1,795.80ms DONE
2022-10-01 19:49:27 App\Listeners\Mail\MailSentListener … 12.51ms DONE
2022-10-01 19:55:29 App\Jobs\Entity\EmailEntity … 2,861.11ms DONE
2022-10-01 19:55:32 App\Listeners\Quote\QuoteEmailActivity . 1,082.14ms DONE
2022-10-01 19:55:34 App\Listeners\Quote\QuoteEmailedNotification 56.46ms DONE
2022-10-01 19:55:34 App\Listeners\Mail\MailSentListener … 13.62ms DONE

Not getting any errors and not receiving any emails.

Ok,

anything in the system_logs tab of the dashboard. if the email is being attempted to send, there should be some further information.

I don’t get any errors in system logs either. I tried using my personal gmail as the SMTP and that email sent fine. It’s weird though because this same configuration was working fine on the prior version of PHP and Invoice ninja <5.5.

I’ve tried a few different configs that my webhost support had me try and got the same result where it appears to send but nothing happens.

it is strange that the system is not reporting back some kind of error. but i think if it is sending via personal gmail, then it most likely is an issue somewhere with your mail configuration.

It was working fine on the previous version. So I don’t understand why the same config isn’t working now. My webhost support whitelisted the IP I’m hosting Invoice Ninja on but I don’t think that’s the issue. If you think of anything else I can look into I’d appreciate it.