Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to send email in VFP?
Message
De
28/04/2001 23:02:53
Larry Rix
Larry Rix & Associates, Inc.
Westminster, Colorado, États-Unis
 
 
À
20/04/2001 09:32:06
Information générale
Forum:
Visual FoxPro
Catégorie:
Applications Internet
Divers
Thread ID:
00497834
Message ID:
00501314
Vues:
56
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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform