Hi Yuri
When I ran the code from within VFP it completed but no email was sent. ( I was trying to send to my hotmail a/c.
So I created an exe and ran it under win2k scheduler. As you know there is no onscreen indication of the program ( no interface) except that it shows "Running..." in the scheduler, which goes away when complete. When no email was received, I started logging progress of every line to a table to see what was going on.
The logging told me that the program was exiting after line 1!
No error as I had error logging on as well. It never got to execute line 2!
Thats the situation as of now.
Bernard
>What do you mean, "I cannot get it to work when run in the win2k scheduler"?
>It gives an error? Or it ask for user permission to send mail at the line msg.send(.t.,.f.) ?
>
>
>>I have a requirement to have a VFP application be able to send email when triggered.
>>
>>I know how to do this with Outlook.
>>
>>The problem is that this app will run "SCHEDULED" on a WIN2K server so there is no user intervention that can be done.
>>
>>I have tried the followinf code:
>>
>>
>>ox= createobject("mapi.session")
>>ox.Logon ("MyName","MyPassword")
>>msg = ox.outbox.messages.add
>>msg.subject = "Re: Automated email"
>>msg.text="This is the body of the message"
>>recip = msg.recipients.add
>>recip.name ="
bernard@myemail.com.au"
>>recip.resolve()
>>msg.send(.t.,.f.)
>>ox.logoff()
>>
>>
>>This works if I am logged on, but I cannot get it to work when run in the win2k scheduler.
>>
>>I have also tried CDO with above same (non)success.
>>
>>Any ideas anyone?
>>
>>Thanks
>>
>>Bernard