nakra
-
Total Posts
:
10
- Scores: 0
-
Reward points
:
0
- Joined: 3/16/2011
-
Status: offline
|
CDO object error in a scheduled task script
Monday, January 16, 2012 7:28 AM
( permalink)
Hello, I have a problem in receiving emails using a vbscript running as a scheduled task. But the same script runs perfectly when is launched from DOS console. As a scheduled task it returns an error message like: CDO.message SendUsing configuration value is invalid. For the simplicity, I won't post the entire script since the only part that doesn't work si the SendeMail procedure. Sub SendeMail(sFrom, sTo, sSubject, sInfo)
Set objMessage = CreateObject("CDO.Message")
oMessage.Subject = sSubject
oMessage.From = sFrom
oMessage.To = sTo
oMessage.TextBody = sInfo
oMessage.Send
Set oMessage = Nothing
End Sub Why the script runs without any error from command prompt, but as scheduled job returns error? The scheduled job was created with target app being wither the script name, either "cscript.exe script_name".
|
|
|
|
59cobalt
-
Total Posts
:
969
- Scores: 91
-
Reward points
:
0
- Joined: 7/17/2011
-
Status: offline
|
Re:CDO object error in a scheduled task script
Monday, January 16, 2012 9:37 AM
( permalink)
You probably should provide an explicit SendUsing configuration. Do you want to relay the message via an SMTP server on localhost or via an external SMTP server?
|
|
|
|
nakra
-
Total Posts
:
10
- Scores: 0
-
Reward points
:
0
- Joined: 3/16/2011
-
Status: offline
|
Re:CDO object error in a scheduled task script
Tuesday, January 17, 2012 8:49 AM
( permalink)
Yes 59cobalt, it was because I didn't provide an explicit SendUsing configuration. Thanks for the tip. After providing the necessary configuration it works. To answer your question, I'm using an external SMTP server to relay the message. Still.. I don't understand why the script needs that extra configuration when running as a job, but when launched from command prompt it needs none. Why is that difference?
|
|
|
|
ebgreen
-
Total Posts
:
8219
- Scores: 98
-
Reward points
:
0
- Joined: 7/12/2005
-
Status: offline
|
Re:CDO object error in a scheduled task script
Tuesday, January 17, 2012 9:21 AM
( permalink)
Well I can't speak to this specific situation, but I can say that scheduled tasks run in the system context by default and not in the user context, so I suspect that you need the explicit configuration due to that.
|
|
|
|
nakra
-
Total Posts
:
10
- Scores: 0
-
Reward points
:
0
- Joined: 3/16/2011
-
Status: offline
|
Re:CDO object error in a scheduled task script
Wednesday, January 18, 2012 7:07 AM
( permalink)
|
|
|
|