Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Cannot send Email when Outlook closed
Message
From
16/01/2003 21:26:27
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Title:
Cannot send Email when Outlook closed
Miscellaneous
Thread ID:
00742714
Message ID:
00742714
Views:
56
Hi,

I'm using the code below to send email automatically from my app.
When outlook is open, it works great.
When outlook is closed it fails.
I get the following error:

OLE Dispatch exceptioncode 4096 from Microsoft Outlook:
The system cannot find the file specified.

Do I need to start Outlook from VFP or is there something else I can do?
If I do need to start Outlook from VFP, how do I do that?

Any thought would be appreciated.

Thnks,
Mark
SendTo="XXX@XXX.COM"
SendFile="c:\test.txt"

myOlApp=CREATEOBJECT("Outlook.Application")
myItem =myOlApp.CreateItem(0) &&Creates a message
myNameSpace=myOlApp.GetNameSpace("MAPI")
myNameSpace.LogOn("XXX","XXX")
myItem.To=SendTo &&Recipient
myItem.Subject="CLAIM: " + vClaimsH.claim_no &&Subject
myItem.Body=""
*= Send Message Label and File to Outlook Outbox ========================
myAttachments = myItem.Attachments &&Creates a collection of attachments
FileAtt='myAttachments.Add("'+SendFile+'")' &&Adds an attachment to the collection
&FileAtt
myItem.Send
myNameSpace.LogOff
Next
Reply
Map
View

Click here to load this message in the networking platform