Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
VFP and Outlook Syntax Question
Message
General information
Forum:
Visual FoxPro
Category:
Other
Title:
VFP and Outlook Syntax Question
Miscellaneous
Thread ID:
00052129
Message ID:
00052129
Views:
79
I have succesfully integrated VFP and Outlook for automatically adding a contact and emailing using the outlook object model, but since I do not have Office 97 yet, I am missing the commands necesary to attach a file to the email I am sending. can someone send me the syntax to attach a file (e.g. c:\temp\out.txt) to an email message. Here is part of the code I have so far (it works):

ooutlook = CreateObject("Outlook.Application")
onamespace = ooutlook.GetNameSpace("MAPI")

SCAN FOR pending = .F.
*** Mail

* Create a new mail message
omailItem = ooutlook.CreateItem(olMailItem)
* Set the properties of the mail message
WITH omailItem
* Add a recipient (Note: If recipient is
* in the address book just use the display name,
* otherwise include the complete address)
WITH .Recipients.Add("Wildridge_Dave@crane.navy.mil")
.Type = olTo
ENDWITH
WITH .Recipients.Add("Hobbs_Bret@crane.navy.mil")
.Type = olCC
ENDWITH
.Subject = "World Wide Web Access Request"
txtbody = CMONTH(DATE())+" "+ALLTRIM(STR(DAY(DATE())))+", "+ALLTRIM(STR(YEAR(DATE())))+' @'+TIME()
txtbody = txtbody+CHR(13)+CHR(13)+CHR(13)+"402 World Wide Web Access Request"
txtbody = txtbody+CHR(13)+CHR(13)+ALLTRIM(fname)+' '+ALLTRIM(lname)+' of '+ALLTRIM(org_name)+' wishes access to the World Wide Web Systems.'
txtbody = txtbody+CHR(13)+'He/She can be reached by phone '+ALLTRIM(phone)+IIF(EMPTY(ALLTRIM(email_to)),' ',' or Emailed at '+ALLTRIM(email_to))
txtbody = txtbody+CHR(13)+CHR(13)+'The reason for access is: '+CHR(13)
*
* Based upon the total lines in the memo field lets write
* out one line at a time
mtotallines = MEMLINES(reason)
* J is used to increment the lines we print
*
j = 1
DO WHILE j <= mtotallines
_MLINE = 0
txtremoutput = MLINE(reason,j,_MLINE)
txtbody = txtbody+CHR(13)+ txtremoutput
j = j + 1
ENDDO
txtbody = txtbody+CHR(13)+CHR(13)+'This message was created by Code 4021 Web Access Generation Program.'
.Body = txtbody

.Importance = olImportanceNormal
* Send it!
.Send
ENDWITH


* reset our pending flag so this record willnot be processed in the
* future
REPLACE pending WITH .T.
ENDSCAN
Bret Hobbs

"We'd have been called juvenile delinquents only our neighborhood couldn't afford a sociologist." Bob Hope
Next
Reply
Map
View

Click here to load this message in the networking platform