Auto Reminder Emails not Sending

I self host and have auto reminder emails set up to be sent 7 days after the due date. However as far as I’m aware these have never yet been sent. I go to the ‘email invoice’ button/menu and click on history and only ever see the initial email having been sent. I’m pretty sure no reminder has been sent as I only get payment once I send a reminder manually myself, which is then recorded in the history section. This is one of the main features I was wanting when I started using Invoice Ninja, so I would very grateful if someone could please help with getting this working. Many thanks in advance.

Have you enabled the crons?

http://docs.invoiceninja.com/en/latest/configure.html

Thanks for the reply, I installed with Softaculous’ Auto Installer so have not had to delve into any code or anything else. I have looked at the link you recommended but not sure that really helped me not sure what a ‘cron’ is I’m afraid.

crons are used to automatically run commands at set times, in this case they’re being used to regularly send the reminders. You may be able to find help enabling them on the Softaculous forums.

For installed via Softaculous or shared hosting you should:

Go to your Cron Jobs option in Cpanel generally under “advanced” section. In that area under “add new cron job” leave “common settings” alone and go down to the time and put in:

0 for minute,

9 for hour,

  • for day, month, and weekday.

Under command put in (make sure to change the “YourPath” to your path. You can use File manager to get the exact path if needed):

/usr/local/bin/php /home/YourPath/ninja/artisan ninja:send-invoices

duplicate the above time of 0,9,,,* for a second cron job but put in

/usr/local/bin/php /home/YourPath/ninja/artisan ninja:send-reminders

For the command.

Under Current Cron jobs you should see:

Minute Hour Day Month Weekday Command Actions
0 9 * * * /usr/local/bin/php /home/YourPath/ninja/artisan ninja:send-invoices Edit Delete
0 9 * * * /usr/local/bin/php /home/YourPath/ninja/artisan ninja:send-reminders

That means EVERY DAY at 9am in the morning it’ll check and see if any invoice reminders or other automated email tasks need to be sent. You can change that 9 under hour to anything based on a 24hour close (24=12am and 12=12pm). Additionally the 0 min means exactly at 9:00am. The * means run this command every day.

Hope that was helpful

Thanks Samual!

Thanks as well, will give that a try and see if I can work that out and let you know how I get on.

Please excuse my ignorance, I assume “yourpath” plus the path before and after needs to lead to the ‘artisan’ File is that correct? If so this is not after a folder labeled ‘ninja’ on my hosting but invoice. I think my path will be the following.

/home5/hornsalo/frenchhornteacher.com/invoice/artisan

Does this look correct? Is there anyway you might be able to check this for me? I did a couple of screen grabs to help but can’t attach them on this Forum.

Thanks in advance, your help is really appreciated.

In case it helps, under general information in CPanel, my Home Directory is listed as
/home5/hornsalo

I followed the above with the Path I suggested and got the following errors emailed to me. Is the path wrong or is it something else. TIA again

Cron <hornsalo@ams21> /usr/local/bin/php /home5/hornsalo/frenchhornteacher.com/invoice/artisan ninja:send-reminders

2017-10-13 Running SendReminders…

[PDOException]
SQLSTATE[28000] [1045] Access denied for user ‘forge’@‘localhost’ (using password: NO)

Cron <hornsalo@ams21> /usr/local/bin/php /home5/hornsalo/frenchhornteacher.com/invoice/artisan ninja:send-invoices
2017-10-13 16:00:03 Running SendRecurringInvoices…

[PDOException]
SQLSTATE[28000] [1045] Access denied for user ‘forge’@‘localhost’ (using password: NO)

I amended the time only to a little in future, to try and get the reminders sent again, and got the following, still not sent and confused what has happened and why I didn’t just get the same errors again as above? I have 6 overdue invoices that require reminders being sent. Thanks again

Cron <hornsalo@ams21> /usr/local/bin/php /home5/hornsalo/frenchhornteacher.com/invoice/artisan ninja:send-reminders

2017-10-13 Running SendReminders…
0 accounts found with fees
4 accounts found with reminders
Jamie Thomas - Habs Horn Teacher: 0 invoices found
Jamie Thomas - Forest Horn Teacher: 0 invoices found
Jamie Thomas - Latymer Horn Teacher: 0 invoices found
Jamie Thomas - DAOS Horn Teacher: 0 invoices found
Done

Open up file manager under Cpanel and see if you can find that file /home5/hornsalo/frenchhornteacher.com/invoice/artisan

artisan will be a file in the root directory (ninja is the common folder name but I guess yours is invoice).

Lets ignore the errors from the first cron job you made, I’m not sure why you would have permission issues there, or if it was a fluke of an issue. Lets just work off the second cron data.

It looks to me like it’s having an issue running the send invoices cron as it’s realizing reminders are needed. Is the send invoices cron job setup to run at the same time or right after the reminders cron job? They are two jobs. Additionally have you put in your SMTP settings under “system settings” and tested to make sure it works? Lastly have you setup all the proper reminder schedules in the “templates & reminders” section of the invoice ninja settings.

Lets see how it goes from there. If the permission issues come back you’ll need to give your webhost a call to setup those cron jobs.

Thanks again for taking the time to reply.

I have all the reminder schedules in the “templates & reminders” section set up correctly. Plus the permissions issue has not arisen again, I think this may have occurred when I made some changes/updates to the .env file which is now all resolved.

In cPanel I use the search function for ‘artisan’ and get the following path /frenchhornteacher.com/invoice/artisan and as mentioned previously my Home Directory is listed as
/home5/hornsalo therefore I assumed /home5/hornsalo/frenchhornteacher.com/invoice/artisan is the correct full path? Is that right? Possibly should it just be /frenchhornteacher.com/invoice/artisan ? Or do I put home/frenchhornteacher.com/invoice/artisan as the ‘home’ automatically refers to my home directory /home5/hornsalo ?

Finally in System Setting I have the ‘Driver’ option set to ‘Mail’ with just my name and from email entered, I am able to send invoices manually from my Invoice Ninja so assumed this was ok. Also the test email works fine, however no sent invoices ever end up in my imap sent mailbox. However I guess this set might not be suitable for automatic emails. Let me know what you suggest here as I can easily setup SMTP if this is required.

Cheers J

Samuel and Hillel - all fixed, so thank you both very much for your help, its really appreciated.

The Path was correct, as were the settings and the Crons info used in cPanel. I had assumed that if an invoice was overdue and the script was run a reminder would get sent. However the script has to be run on the same dame that a reminder is set, not after. This obviously works fine and well once all is up and running but not when its been setup halfway through issuing invoices and the reminder day has passed. I only realised this as today was the 2nd reminder day and all were issued fine.

Oh that’s great! I’m glad to hear it worked out and you responded with the resolution, I’m sure it’ll help others. Invoice Ninja is amazing and has made my life tremendously easier, I hope it assists you also. White Labeling is really cheap also and gives it an incredibly professional look.

A final note. You should adjust the forwarding of your site via cpanel if you want to redirct your site straight to the invoice page. currently it’s coming up as a directory tree, easy way would be to just go to forwarding and set it to the /invoice page.

Additionally to backup your setup of invoice ninja you should look at the backup section of your cpanel and do a directory backup and a database backup. I recommend doing that and downloading it locally to your computer at the bare min once a month. Don’t trust your webhost to be doing it for you.

Best of luck