Emails not sending

Hi folks,

This is with v4.5, although it’s been happening for months (so with earlier versions).

It is self-hosted.

Mailgun is correctly configured, and the test email goes out fine.

Recurring invoice reminders are not sending out.

I have cron set up as per instructions here.

This error shows up every day in the laravel-error.log file:

[2018-07-13 08:00:02] production.ERROR: ***ErrorException*** [0] : /opt/bitnami/apps/invoicing/htdocs/app/Console/Commands/SendReminders.php 
[Line 210] => Undefined property: stdClass::$rates  {"context":"PHP","user_id":0,"account_id":0,"user_name":"",
"method":"GET","user_agent":"","locale":"en","ip":"127.0.0.1","count":1,
"is_console":"yes","is_api":"no","db_server":"mysql","url":"/"} []

(carriage returns in above output were added by me, as the forum is not displaying CODE or BLOCKQUOTE correctly. It runs off the screen)

When I look up the invoices in the system, they are in a Draft status. That makes no sense to me. I can manually make them send out (“Email Invoice” button), and they go out.

Please advise what the issue is.

Thanks very much,

Jonathan

Can you check the auto-send workflow checkbox on Settings > Invoice Settings

Hi Hillel.
It was checked.
Please see the update in my question. I’ve included an error that occurs daily.

Are you still seeing the error with v4.5?

I couldn’t say. I just updated about 30 minutes ago.

I don’t believe that error is related, it should be fixed with v4.5.

Sorry, I’m not sure why the emails aren’t being sent…

I just ran send-invoices and send-reminders manually. Send-invoices reported back with:

Fri, 13 Jul 2018 09:57:33 +0000 Running SendRecurringInvoices…
Fri, 13 Jul 2018 09:57:33 +0000 2 recurring invoice(s) found
Fri, 13 Jul 2018 09:57:33 +0000 0 due recurring invoice instance(s) found
Fri, 13 Jul 2018 09:57:33 +0000 0 recurring expenses(s) found
Fri, 13 Jul 2018 09:57:33 +0000 Done

However, the two invoices that were generated (last month) as still sitting there in Draft status, unsent. The error did not occur in the log after doing this manual send-invoices command.

I’d suggest trying to create a new test recurring invoice and then run the script.

I set up a new recurring invoice. Due for sending out today.

Running the send-invoices script manually, I get this output

Fri, 13 Jul 2018 10:03:27 +0000 Running SendRecurringInvoices...
Fri, 13 Jul 2018 10:03:27 +0000 3 recurring invoice(s) found
Fri, 13 Jul 2018 10:03:27 +0000 Processing Invoice: 14
Fri, 13 Jul 2018 10:03:28 +0000 Not billed - Sending Invoice
Fri, 13 Jul 2018 10:03:28 +0000 0 due recurring invoice instance(s) found
Fri, 13 Jul 2018 10:03:28 +0000 0 recurring expenses(s) found
Fri, 13 Jul 2018 10:03:28 +0000 Done

So it detected the new invoice, and indicates sending it. But it is still sitting there as a draft. Not sent.

Also, when I view the newly created Recurring invoice editor, it shows, “Sent Last: 13-Jul-2018”. So the system seems to think it’s sending them. But it’s generating an invoice, and leaving it in Draft, and not sending it.

One thought is maybe the CLI version isn’t getting the correct .env parameters.

You can check it by running: php artisan tinker

And then: env('parameter_name');

It returns null

I just noticed the owner permissions on the content of htdocs folder was all over the place. Many were correct, many were not. Including the .env files, had incorrect ownership.

I’ve set them all to what the server requries.

Is there anything I need to do to get the environment parameters read into where there are needed?

I’m not sure, you may need to ask your webhost for help.

I am the web host.

It’s a VM with Wordpress and Invoice Ninja running on it.
WP is running fine. Invoice Ninja is running mostly fine, except for the emails not going out.

If I was to ask the web host for help, what would I be asking them to do? I’ll need to do those things myself.

I can help with the app but it seems like the problem is related to your specific server configuration.

I’m a developer not a systems person, maybe someone else will have more advice.

Okay. Thanks for trying.

It seems odd to me that I can send test emails, and can manually send payment notices.
I notice, however, that when I manually send one of the recurring invoices (which is sitting there in Draft status), it appears to have sent, but then it remains in Draft status, and Mailgun does not show it was sent (so it’s not being sent).

Could all that be environment related? Seems more likely to be something with the app. Does it not?

Have you run config:cache, if yes you’d need to run config:clear

I am not sure where I’d be running that. Is it a command for …/artisan ?

I figured out it’s an artisan command. I’ve run it. Came back with ‘Configuration cache cleared!’

How would I know if this worked? By trying to send an invoice?