Jennifer Zhou
Jennifer Zhou

Reputation: 343

Schedule Nodemailer email based on info in database

I am creating an application that stores events and sends reminder emails to people who signed up 1 hour before the event(the time of each event is stored in the database). At first I was thinking about using CronJobs to schedule these emails, but now I am not sure if that will work. Is there any other node module that will allow me to implement the reminder email functionality.

Upvotes: 1

Views: 2292

Answers (2)

Shams Nahid
Shams Nahid

Reputation: 6559

You can give a try node-schedule. It is using cron-job underneath.

In a quality interval, you can check if there is an upcoming interval, and send the reminder to the appropriate persons.

Upvotes: 0

Nick Cox
Nick Cox

Reputation: 6452

If you have Redis available to backend it, you might look at something like bull. From the readme:

  • Minimal CPU usage due to a polling-free design.
  • Robust design based on Redis.
  • Delayed jobs.
  • Schedule and repeat jobs according to a cron specification.
  • Rate limiter for jobs.
  • Retries.
  • Priority.
  • Concurrency.
  • Pause/resume—globally or locally.
  • Multiple job types per queue.
  • Threaded (sandboxed) processing functions.
  • Automatic recovery from process crashes.

Upvotes: 1

Related Questions