# Automatic unpaid invoice notification - email

**URL:** <https://www.dolibarr.org/forum/t/automatic-unpaid-invoice-notification-email/21460>\
**Category:** Using my Dolibarr\
**Tags:** Cron, Invoices, v14, Scheduled-Jobs\
**Created:** [November 20, 2021, 11:48pm UTC](https://www.dolibarr.org/forum/t/automatic-unpaid-invoice-notification-email/21460 "2021-11-20T23:48:25Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![steph\_inventv](https://www.dolibarr.org/forum/letter_avatar_proxy/v4/letter/s/f6c823/32.png) [@steph\_inventv](https://www.dolibarr.org/forum/u/steph_inventv)\
**Post date:** [November 20, 2021, 11:48pm UTC](https://www.dolibarr.org/forum/t/automatic-unpaid-invoice-notification-email/21460/1 "2021-11-20T23:48:25Z")

</div>

Hello,

I have activated a cron job to run the automatic email notification that is sent for unpaid invoices.

In the example proposed by Dolibarr in the latest version 14.0.3, it is indicated " Send an emails when the unpaid invoices reach a due date + n days = today. First param is the offset n of days, second parameter is “all” or a payment mode code, last paramater is the code of email template to use (an email template with EmailTemplateCode must exists. the version in the language of the thirdparty will be used in priority)."

I have set the parameter to 10,all,EMAILCOD

For tests, I have created an invoice with due date 11/11/2021 and I was expecting to get a notification on 21/11/2021 since I have set 10 days as the offset days but I did not any notification and on the planified task, I have a message indicating that this task is looking for invoices that have a due date 31/11/2021 so I do not understand how it works since it should look for invoices that have due date 11/11/2021.

Any idea how it works and if I missed something?

Thank you in advance

Regards

---

<div class="post-metadata">

**Author:** ![priojk](https://www.dolibarr.org/forum/user_avatar/www.dolibarr.org/priojk/32/6121_2.png) [@priojk](https://www.dolibarr.org/forum/u/priojk)\
**Post date:** [November 21, 2021, 9:09pm UTC](https://www.dolibarr.org/forum/t/automatic-unpaid-invoice-notification-email/21460/2 "2021-11-21T21:09:58Z")

</div>

Would -10 work as expected? Just wondering.

---

<div class="post-metadata">

**Author:** ![steph\_inventv](https://www.dolibarr.org/forum/letter_avatar_proxy/v4/letter/s/f6c823/32.png) [@steph\_inventv](https://www.dolibarr.org/forum/u/steph_inventv)\
**Post date:** [November 21, 2021, 9:40pm UTC](https://www.dolibarr.org/forum/t/automatic-unpaid-invoice-notification-email/21460/3 "2021-11-21T21:40:53Z")

</div>

Hello,

Thank you for your reply.

In fact I have tried to put -10 and seems to be working. I am waiting to retest this evening.

By the way, I have checked the function facture.class.php and found this comment  
“@param int $nbdays Delay after due date (or before if delay is negative)”

Either it is a problem with the comment or the code works in the way around 🙂

I will keep you posted  
Regards
