Skip to content

This is a node js program that automates sending emails using node-cron module. And it schedules email sending in a specified period of time

Notifications You must be signed in to change notification settings

N-Pacis/automated-emails-node-js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CLONE THE PROJECT AND RUN IT IN TERMINAL USING THE FOLLOWING COMMANDS

  • yarn add .
  • node app.js

This is a program that automates sending email to users using a specified period of time and uses node-cron module

Let us learn about node-cron

  • we schedule the cron job and it's format is cron.schedule('minute hour date month dayOfTheWeek',function())
  • The function is a callback function that is executed at the specified time
  • If we don't want to mention any of the above time parameters we replace it with asterisks and for the provided example this means that the cron job will be executed every Monday(1) at 8:00

You can go ahead and replace the array values of users array in app.js in order to send emails to specific users and you can adjust the defined time in node-cron.schedule parameters. And then head to .env file to add auth email address and password and make sure in the provided email address 'less-secure apps is enabled'

DON'T FORGET TO STAR THE PROJECT AND TO CONTRIBUTE

About

This is a node js program that automates sending emails using node-cron module. And it schedules email sending in a specified period of time

Topics

Resources

Stars

Watchers

Forks