本文介绍了node实现定时发送邮件的示例代码,分享给大家,具体如下:
定时发送,可做提醒使用
nodemailer
nodemailer 是一款简单易用的基于于SMTP协议(或 Amazon SES)的邮件发送组件
cron
cron可以指定每隔一段时间执行指定的程序、也可以指定每天的某个时刻执行某个程序、还可以按照星期、月份来指定。
npm install nodemailer -S
npm install nodemailer-smtp-transport -S
npm install cron -S
代码中有详细的注释(同时希望大家在平时写代码的时候养成写注释的习惯)