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
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);