I am having problems running a VBScript via a task scheduler on a shared server.
I can get the attached VBScript to send an email fine via a Test Command button provided in the task scheduler admin but if I schedule the script it doesn't send. I have no error logs but I have been told the following by server admin staff:
"The 'Test Command' button will execute the script specified, with many pre-defined environment variables that may not be available when it's actually ran on the server in the scheduled task environment. Can we ask you review this script, and any variables that in my rely on being defined in the environment, are defined manually in the script, which should then resolve this issue."
I have been using the following CMD in a BAT file.
Function sendMail(fromName, from, rcpt, subject, body)
Set mail = WScript.CreateObject ("CDONTS.NewMail")
mail.From = from &"("&fromName&")"
mail.Subject = subject
mail.To = rcpt
mail.BodyFormat = 0
mail.MailFormat = 0
mail.Body = body
set mail = nothing
sendMail "Web site", "firstname.lastname@example.org", "email@example.com", "CRON EMAIL TEST", "CRON EMAIL TEST"