Hi friends,
In my application I am required to make a Cron to send emails to my users.
For this I am using the following code. But In task scheduler it gets marked as "Task Completed" and do not receive the email, though it works when I hit "Email.aspx" from
"http://localhost:51611/Cron/Email.aspx"
and the necessary flags get updated in the database.
I am using
1. CronMail.js - A java script that hit the Email.aspx page.
2. Email.aspx -- this is the page that process the email task.
CronMail.js
var strUrl = new Array("http://localhost:51611/Cron/Email.aspx");
var webObj = WScript.CreateObject("MSXML2.ServerXMLHTTP");
var lResolve = 10 * 1000;
var lConnect = 10 * 1000;
var lSend = 60000 * 1000;
var lReceived = 60000 * 1000;
webObj.setTimeout(lResolve, lConnect, lSend, lReceived);
for (var i = 0; i < strUrl.length; i++) {
webObj.open("GET", strUrl[i], false);
try {
webObj.send();
if (webObj.status != 200 || String(webObj.statusText).match(/Database is currently unavailable/gi) != null) {
}
}
catch (e) {
}
}
But when I configured this with task scheduler, using
"cscript.exe"
is not working and neither the values got updated in database nor email were being sent. The same configuration is done with other application that are working.
Please guide me.