Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

send email attachment with foxpro 2

Status
Not open for further replies.

hodge2

IS-IT--Management
Sep 14, 2001
4
US
I found the following code on your site and it works great. How do I add an attachment?

oApp = createObject("Outlook.Application")
oMail = oApp.CreateItem(0)
oMail.to = "whoever@wherever.com"
oMail.subject = "Email from VFP"
oMail.body = "Test email sent directly from FoxPro."
oMail.send()
release oApp
release oMail
 
Here is another version of the same automation with attachement:
Code:
#DEFINE MAILITEM 0
#DEFINE IMPORTANCELOW 0
#DEFINE IMPORTANCENORMAL 1
#DEFINE IMPORTANCEHIGH 2

oOutLookObject = CreateObject("Outlook.Application")
oEmailItem = oOutLookObject.CreateItem(MAILITEM)

WITH oEmailItem
   .Recipients.Add("moe@3stooges.com") && uses the Recipients collection
   .Subject = "Automation sample"
   .Importance = IMPORTANCENORMAL
   .Body = "This is easy!"
   .Attachments.Add("c:\mydir\sample.txt") && Note that the fully qualified path and file is required.
   .Send
ENDWITH

RELEASE oEmailItem
RELEASE oOutLookObject

 
HI
**********************************************************
o=createobject("outlook.application")
oitem=o.createitem(0)
oitem.subject="Email From VFP6"
oitem.to="ramani_g@yahoo.com"
oitem.body="This mail was sent from vfp using Outlook98"
[COLOR=/blue]
oitem.Attachments.Add("MyFullPath+MyFile+Ext")
[COLOR=/]
oitem.send
o=.null.
**********************************************************
ramani :)
(Subramanian.G),FoxAcc, ramani_g@yahoo.com
 
Danceman

When I tried your link, I get to a page, but I see no mention of MAPI or SHELLEXECUTE. Any hints as to where to find the info.

 
when you get to the site select the Q&A section, then select General. At this listing you will see two samples.
Attitude is Everything
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top