如何安排电子邮件白名单req.body和node-cron [英] How to schedule email whit req.body and node-cron
问题描述
我需要安排电子邮件发送,我正在使用node-cron. 我想知道如何使用"req.body"来安排日期和时间.
i need to schedule email send, i'm using node-cron. i want to know how to use "req.body" for date and time to schedule.
我需要帮助来解决如何在代码的这一部分中插入req.body
i need help to resolve how insert in this part of code the req.body
cron.schedule('* * * * *')
,如果有用,也可以使用
and if useful to use
<input type="time">
<input type="date">
感谢所有人
推荐答案
由于节点cron表达式是字符串,因此可以以字符串形式传递变量 像
Since the node cron expression is string you can pass the variables in form of string something like
let c="0";
cron.schedule(`${c} * * * * *`, ()=>{ // you can use template literals to pass variable args
// your job runs every minute
})
与明智的做法一样,您可以根据需要传递不同的参数. 您可以在此处参考节点cron的官方文档- https://www.npmjs.com/package/节点cron
Like wise you can pass different arguments according to your requirements. You can refer official documentation of node cron here-https://www.npmjs.com/package/node-cron
这篇关于如何安排电子邮件白名单req.body和node-cron的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!