I have an express server as backend for my react app. Once a week each user should receive an email. I've looked up how cron jobs are done in Node and it seems to be quite straight forward. I would just set up a cron job that triggers the respective function, which loops through all the email addresses and sends out the mails. However, I'm not entirely sure if that's the way to go.
When sending emails, the server has to store the sent receipts. For that, it passes an email address to the respective API and awaits the receipt to store it in the DB. Therefore, sending an email might take a few minutes per user.
Now I'm wondering if setting up a cron job for this task will block my entire server until all emails are sent. Is it recommended to create a child process that is triggered by the cron job to loop through all the email adresses?
It would be great if you could give me some general recommendations and maybe examples, so that I know how to get started. Thank you for your time.