Search code examples
node.jsangularemailcronnodemailer

Send scheduled email reports from Angular using node.js


I have set up an Angular project and it is consuming APIs from the NodeJS app.

Angular dashboards have some reports/charts, I will configure a schedule somewhere in DB. I want to add scheduling functionality so that I will get an automated email containing a graph/chart as an email body.

Can anyone guide me here!


Solution

  • Your scheduling will have to happen out of the NodeJS app since that can be always 'alive' The Angular project is only doing things when you've loaded it in your browser and cannot process that scheduled emails when you don't have it open (unless you were to make it a PWA perhaps, but then still it would be rather convoluted to do it out of Angular).

    Do all the processing on the server, including generating and rendering the charts to an email message that you send over SMTP or through a service like Mailgun or Sendgrid.