Automatic sending of cron generated recurring invoices

Hello Forum,
I am using Dolibarr 12.0.4 and want to get sent recurring invoices generated and approved automatically by cron job to the thirdparty invoice recipient.

So, I searched and found the module sendrecurringinvoicebymail version 0.2.4 and installed it successfully ( ).
As per the Dolibarr log file sendrecurringinvoicebymail is launched: “HookManager::initHooks Loading hooks: context=cron-path=/sendrecurringinvoicebymail/class/actions_sendrecurringinvoicebymail.class.php”

But it seems that the sendto address is not pulled becaus it is empty in the log file:
— snip —
CMailFile::CMailfile: sendmode=smtps charset=UTF-8, to= <>, addr_cc=, addr_bcc=, errors_to=, trackid= sendcontext=standard
— snap —

In sendrecurringinvoicebymail/class/actions_sendrecurringinvoicebymail.class.php the expression to pull the recipients’ data is:
$sendto = $object->thirdparty->name . ’ <’ . $object->thirdparty->email . ‘>’;

I think that this is the position where something has to be changed to get it work correctly. But how?

Perhaps, someone can help me with this. Send recurring invoices automatically after creation might be interesting for everyone who deals with recurrent invoices.

Thank you!

If you are able to debug, you can see actual data coming into the variables and see where the data isn’t saved in the ‘to’ variable. Next you can make a solution in your code.

I found the solution and it works now.

Just added “$object->fetch_thirdparty();”



Kind regards

1 Like

Hi, exactly where in the document should this line be added? Also should I create a scheduled task?

Hi jmery,

please excuse I have not seen your question. I have put it here and it works:

// L’objet n’est pas à jour ('manque last_main_doc entre autres)

Without warranty :slight_smile: good luck


I am using the same solution. Maybe there has been a fix since because I get the e-mail and I did not change anything in the code.

However, I have another problem. I have edited the e-mail template but I am receiving it in plain text (I can see all the source/html code in the e-mail).

Did I miss something?

Thank you