Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sending Email from Scheduled Tasks

Status
Not open for further replies.

Mighty

Programmer
Feb 22, 2001
1,682
US
Hi All,

I am currently using a Windows 2003 server to send out reports and perform other tasks.
These are primarily VBscript programs which I am executing using wscript and are all setup as scheduled tasks. These have been working away fine for years.

However, as Windows Server 2003 is now end of life I am trying to move all these scheduled tasks to a Windows 2012 server. However, I am finding that the tasks will not send out emails when scheduled but they will send emails when I run them manually. I have setup a simple test script to just send an email:

set objCDO = CreateObject("CDO.Message")
objcdo.to = "me@mymail.com"
objCDO.From = "me@mymail.com"
objCDO.Subject = "Email Test"
objCDO.HTMLBody = "This is a test - " & Now()
objCDO.SEnd
set objCDO = nothing

I also setup a simple batch file to run this:

wscript.exe "S:\scripts\Once Off reports or scripts\EmailTest1.vbs"

I run the batch file manually and it works no problems - email is sent
When I create a schedule task to run the batch file and set it to run as the same user (the one I am logged in as), tasks scheduler says the task has run but no email is sent.
Can anyone please offer some advice on this.


Mighty
 
Thanks for the response
Unfortunately I have quite a number of script programs and some of them are very complex so changing to Powershell would be a big job
Everything works fine apart from the email issue.

Any other suggestions?

Mighty
 
Nothing in the event viewer

Mighty
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top