I'm not sure what's the best way to add a delay of 10 seconds.
setTimeouts don't work, I'm not sure...
In python, I'm used to doing "time.sleep"
I'm not asking for how to send an email. I'm asking how to execute a command every 10 seconds.
setTimeout will work but you have to recreate the timeout at the end of each function call.
You'd do that like this.
function sendEmail() {
email.send(to, headers, body);
setTimeout(sendEmail, 10*1000);
}
setTimeout(sendEmail, 10*1000);
What you probably want is setInterval.
function sendEmail() {
email.send(to, headers, body);
}
setInterval(sendEmail, 10*1000);