Emails not sending to Clients? But sending to me fine?

Version ie <v5.10.30>

v5.10 latest

Environment <Docker/Shared Hosting/Zip/Other>

Docker rootless

Checklist

  • Can you replicate the issue on our v5 demo site https://demo.invoiceninja.com or Invoice Ninja?
  • N/A
  • Have you searched existing issues?
  • Extensively
  • Have you inspected the logs in storage/logs/laravel.log for any errors?
  • Yes

Describe the bug

No emails are sent to client’s email addresses when sending invoices or quotes. A copy of the invoice and quote is sent to me just fine. Testing the email settings results in a success every time.

Steps To Reproduce

Expected Behavior

Expect an email to be sent to client when emailing invoice and/or quote

Additional context

This was working just fine previously. My server got compromised and I had to redo the whole server. Luckily I had a complete backup of the docker data and compose file. I moved the docker data from the old server to the new server and started the container. Everything works just fine except for the emailing of the invoices/quotes to my clients.
When I send an invoice/quote, I get an email letting me know that the invoice/quote was sent. Client does not get an email. I’ve tested with many email accounts and nothing in spam or primary or other folders.

Screenshots

Logs

System logs are not showing any errors related to email.

Hi,

Have you tried adding your emails as a BCC in the email settings to confirm it’s sent. Maybe the email is in your client’s spam folder?

Hi @hillel! Thanks, but yes, unfortunately, not a spam issue at all. I created a client with my personal Gmail address to test and I’m not receiving it in spam or any of the other folders. I even switched out different SMTP servers with no luck. Funny thing, I can’t even seem to be able to find the setting I had originally set to send a notification to me when an invoice or quote goes out… lol… but it seems that email is the only one sending. I’ve populated the CC field and the BCC setting with no luck as well. One of the SMTP servers I’m sending from is a Sparkpost account that has DKIM, SPF and everything all setup as I’m using it to send from other softwares so I know the service is delivering fine.
Do you know of any advanced logging I could access or turn on? I’ve checked the Docker container logs and the system logs inside of Invoice Ninja.

You can add EXPANDED_LOGGING=true to the .env file which will add more logs to storage/logs but I’m not sure if it will help here.

I suggest testing with a different mail provider.

Thanks, I’ll try that logging variable just in case and I’ll try a third SMTP provider. I’m not convinced it’s that though as I’m getting the notification email so the system is sending. Even when I send an invoice to myself at the email address I’m getting the notification email at, I still don’t get the invoice, just the notification email that an invoice was sent.
Interestingly, I just noticed a 404 error on the invoice email history too… for every invoice I’ve looked at. Wonder if it’s related? I can’t find a table for email history in the database…

Can you share a screenshot of the health check dialog?

Think I found the possible issue! Could the email not send if there’s a permissions failure that is causing the the raw PDF to not generate? It looks like the email sending is part of that stack…
This error is the last one in my failed_jobs table.

Payload:
{“uuid”:“97fd26c0-ff9e-44f6-b6a3-bfd674962f8e”,“displayName”:“App\Services\Email\Email”,“job”:“Illuminate\Queue\CallQueuedHandler@call”,“maxTries”:4,“maxExceptions”:null,“failOnTimeout”:false,“backoff”:“27,55,70,271”,“timeout”:null,“retryUntil”:null,“data”:{“commandName”:“App\Services\Email\Email”,“command”:“O:24:"App\Services\Email\Email":2:{s:12:"email_object";O:30:"App\Services\Email\EmailObject":35:{s:2:"to";a:0:{}s:4:"from";N;s:8:"reply_to";a:0:{}s:2:"cc";a:1:{i:0;O:33:"Illuminate\Mail\Mailables\Address":2:{s:7:"address";s:23:"[email protected]";s:4:"name";N;}}s:3:"bcc";a:0:{}s:7:"subject";N;s:4:"body";s:163:"

Dear $client,

An Invoice has been generated. To view your invoice for $amount, please click the link below.

Thank you!</p>\n

$view_button</div>";s:9:"text_body";s:0:"";s:11:"attachments";a:0:{}s:8:"settings";N;s:10:"whitelabel";b:0;s:4:"logo";N;s:9:"signature";N;s:8:"greeting";N;s:13:"invitation_id";i:2683;s:9:"entity_id";i:1658;s:9:"client_id";i:28;s:9:"vendor_id";N;s:7:"user_id";N;s:17:"client_contact_id";N;s:17:"vendor_contact_id";N;s:19:"email_template_body";s:22:"email_template_invoice";s:22:"email_template_subject";s:21:"email_subject_invoice";s:13:"html_template";N;s:13:"text_template";s:19:"email.template.text";s:7:"headers";a:0:{}s:12:"entity_class";s:18:"App\Models\Invoice";s:9:"variables";a:0:{}s:8:"override";b:0;s:14:"invitation_key";N;s:9:"documents";a:0:{}s:8:"template";s:22:"email_template_invoice";s:5:"links";a:0:{}s:6:"button";N;s:3:"url";N;}s:7:"company";O:45:"Illuminate\Contracts\Database\ModelIdentifier":5:{s:5:"class";s:18:"App\Models\Company";s:2:"id";i:1;s:9:"relations";a:0:{}s:10:"connection";s:5:"mysql";s:15:"collectionClass";N;}}”},“sentry_baggage_data”:“sentry-trace_id=276b387ca3144dde831b9302f1bb6bb1,sentry-public_key=39389664f3f14969b4c43dadda00a40b,sentry-release=5.10.62,sentry-environment=production”,“sentry_trace_parent_data”:“276b387ca3144dde831b9302f1bb6bb1-dff706e8b1e142d1”,“sentry_publish_time”:1741200565.897787,“db”:“mysql”}

Exception:
App\Exceptions\FilePermissionsFailure: Unable to generate the raw PDF in /var/www/app/app/Jobs/Entity/CreateRawPdf.php:115
Stack trace:
#0 /var/www/app/app/Services/Email/EmailDefaults.php(311): App\Jobs\Entity\CreateRawPdf->handle()
#1 /var/www/app/app/Services/Email/EmailDefaults.php(77): App\Services\Email\EmailDefaults->setAttachments()
#2 /var/www/app/app/Services/Email/Email.php(234): App\Services\Email\EmailDefaults->run()
#3 /var/www/app/app/Services/Email/Email.php(109): App\Services\Email\Email->setDefaults()
#4 /var/www/app/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): App\Services\Email\Email->handle()
#5 /var/www/app/vendor/laravel/framework/src/Illuminate/Container/Util.php(43): Illuminate\Container\BoundMethod::Illuminate\Container{closure}()
#6 /var/www/app/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(95): Illuminate\Container\Util::unwrapIfClosure(Object(Closure))
#7 /var/www/app/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(35): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure))
#8 /var/www/app/vendor/laravel/framework/src/Illuminate/Container/Container.php(694): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL)
#9 /var/www/app/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(126): Illuminate\Container\Container->call(Array)
#10 /var/www/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(144): Illuminate\Bus\Dispatcher->Illuminate\Bus{closure}(Object(App\Services\Email\Email))
#11 /var/www/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(119): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(App\Services\Email\Email))
#12 /var/www/app/vendor/laravel/framework/src/Illuminate/Bus/Dispatcher.php(130): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#13 /var/www/app/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(124): Illuminate\Bus\Dispatcher->dispatchNow(Object(App\Services\Email\Email), false)
#14 /var/www/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(144): Illuminate\Queue\CallQueuedHandler->Illuminate\Queue{closure}(Object(App\Services\Email\Email))
#15 /var/www/app/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(119): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline{closure}(Object(App\Services\Email\Email))
#16 /var/www/app/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(123): Illuminate\Pipeline\Pipeline->then(Object(Closure))
#17 /var/www/app/vendor/laravel/framework/src/Illuminate/Queue/CallQueuedHandler.php(71): Illuminate\Queue\CallQueuedHandler->dispatchThroughMiddleware(Object(Illuminate\Queue\Jobs\DatabaseJob), Object(App\Services\Email\Email))
#18 /var/www/app/vendor/laravel/framework/src/Illuminate/Queue/Jobs/Job.php(102): Illuminate\Queue\CallQueuedHandler->call(Object(Illuminate\Queue\Jobs\DatabaseJob), Array)
#19 /var/www/app/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(441): Illuminate\Queue\Jobs\Job->fire()
#20 /var/www/app/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(391): Illuminate\Queue\Worker->process(‘database’, Object(Illuminate\Queue\Jobs\DatabaseJob), Object(Illuminate\Queue\WorkerOptions))
#21 /var/www/app/vendor/laravel/framework/src/Illuminate/Queue/Worker.php(178): Illuminate\Queue\Worker->runJob(Object(Illuminate\Queue\Jobs\DatabaseJob), ‘database’, Object(Illuminate\Queue\WorkerOptions))
#22 /var/www/app/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(148): Illuminate\Queue\Worker->daemon(‘database’, ‘default’, Object(Illuminate\Queue\WorkerOptions))
#23 /var/www/app/vendor/laravel/framework/src/Illuminate/Queue/Console/WorkCommand.php(131): Illuminate\Queue\Console\WorkCommand->runWorker(‘database’, ‘default’)
#24 /var/www/app/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(36): Illuminate\Queue\Console\WorkCommand->handle()
#25 /var/www/app/vendor/laravel/framework/src/Illuminate/Container/Util.php(43): Illuminate\Container\BoundMethod::Illuminate\Container{closure}()
#26 /var/www/app/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(95): Illuminate\Container\Util::unwrapIfClosure(Object(Closure))
#27 /var/www/app/vendor/laravel/framework/src/Illuminate/Container/BoundMethod.php(35): Illuminate\Container\BoundMethod::callBoundMethod(Object(Illuminate\Foundation\Application), Array, Object(Closure))
#28 /var/www/app/vendor/laravel/framework/src/Illuminate/Container/Container.php(694): Illuminate\Container\BoundMethod::call(Object(Illuminate\Foundation\Application), Array, Array, NULL)
#29 /var/www/app/vendor/laravel/framework/src/Illuminate/Console/Command.php(213): Illuminate\Container\Container->call(Array)
#30 /var/www/app/vendor/symfony/console/Command/Command.php(279): Illuminate\Console\Command->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#31 /var/www/app/vendor/laravel/framework/src/Illuminate/Console/Command.php(182): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Illuminate\Console\OutputStyle))
#32 /var/www/app/vendor/symfony/console/Application.php(1094): Illuminate\Console\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#33 /var/www/app/vendor/symfony/console/Application.php(342): Symfony\Component\Console\Application->doRunCommand(Object(Illuminate\Queue\Console\WorkCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#34 /var/www/app/vendor/symfony/console/Application.php(193): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#35 /var/www/app/vendor/laravel/framework/src/Illuminate/Foundation/Console/Kernel.php(197): Symfony\Component\Console\Application->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#36 /var/www/app/artisan(35): Illuminate\Foundation\Console\Kernel->handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#37 {main}

Here’s that health check

You could try disabling the PDF attachment on Settings > Email Settings to see if it helps.

Yes sir! With PDF attachment off the email sends just fine. Welp, at least my clients can get my invoices again… lol… now to hunt down that file permissions issue.
Definitely appreciate all the help!!

Glad to hear it, thanks for the update!