简体   繁体   中英

How to send emails every day without using CRON?

I am developing outdated dependency checker with Node.js. User sends repository url and email list to API. API returns outdated ones. That's okay but let's say user sent request to API at 12.25.2021 - 3:58 PM. API should check outdated ones every 24 hours and it should email to every email address in email list. For example: API should check outdated ones at 12.25.2021 - 3:58 PM and send email to email list, 12.26.2021-3:58PM, 12.27.2021-3:58PM... I can develop a CRON for this but let's say we have 2 repositories in our DB and CRON should run every minute to check "should we send an email at the moment?". That's a waste of resources.. How can i achieve this without using CRON? Can I use RabbitMQ for this?

If you are using Linux, Android or Unix machine.

You can create a timed systemd service. Read example with scheduled email sender here .

If you are using a Windows machine.

You can use the Windows scheduler service.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM