Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to send email in VFP?
Message
From
28/04/2001 23:02:53
Larry Rix
Larry Rix & Associates, Inc.
Westminster, Colorado, United States
 
 
To
20/04/2001 09:32:06
General information
Forum:
Visual FoxPro
Category:
Internet applications
Miscellaneous
Thread ID:
00497834
Message ID:
00501314
Views:
54
If the target system has Outlook98 or Outlook2000 (sorry OutlookExpress will NOT work), you can use Outlook as an automation OLE server. Here are some example:

**************************************************
local loOutLook, loEmailItem, loAttachment, lcFile

loOutlook = createobject('outlook.application')
loEmailItem = loOutlook.CreateItem(0)
loEmailItem.To = "somebody@somewhere.com"
loEmailItem.CC = "someoneelse@wheretheyare.com"
loEmailItem.BCC = "secretperson@guesswhere.com"
loEmailItem.Body = "This is the text body message that I want to send."
loAttachment = loEmailItem.Attachments
lcFile = "c:\MyDocuments\SomeFile.doc"
loAttachment.Add(lcFile)
loEmailItem.Send
loOutlook = .null.
release loOutlook
**************************************************

In this example we 1) create an instance of outlook, 2) tell outlook to create an email item, 3) set the To, CC, BCC, and the message body text, 4) add a file to the email item as an attachment object, and 5) we tell the email item to send itself. Finally, we close out our reference on Outlook and our local variable.

The only problem with this method is that it forces you or your user to have Outlook98/2000. The reason you cannot use OutlookExpress is because it cannot serve as an OLE automation server.

Hope this helps.

Larry Rix
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform