Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Outlook automation from VFP
Message
 
To
All
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Outlook automation from VFP
Miscellaneous
Thread ID:
00515629
Message ID:
00515629
Views:
44
Hi,
I've been using the code below recently to mail customers using data from my tables. All has been well. However - I would like to use the same/similar code to send a particular file from a remote machine to my office.

Is there a simple one-line command (e.g. thismailitem.attachment = \\ccccc\ccc.dbf) that can be added to this code?

I'm aware of the VFP MAPI classes/wrappers, but - if such a thing exists - I'm
after a quick fix.

**************************

strProfile = "profile"
strPassword = "profile"
strRecipient = "anybody@domain.co.uk"
strSubject = "customer.dbf" + dtoc(date())+" "+ time()
strBody = "Hello you. Please find file attached."

theApp = CreateObject("Outlook.Application")
theNameSpace = theApp.GetNameSpace("MAPI")
theNameSpace.Logon(strProfile , strPassword)
theMailItem = theApp.CreateItem(0)

theMailItem.Recipients.Add( strRecipient )
theMailItem.Subject = strSubject
theMailItem.Body = strBody
theMailItem.Send
theNameSpace.Logoff
Next
Reply
Map
View

Click here to load this message in the networking platform