The information in this article applies to:
SUMMARYThe FoxPro Extensions that come with the Workgroup templates enable FoxPro developers to tap into the mail messaging API (MAPI) and the Microsoft Schedule+ API (SPLUS). Below is a simple example of how to send an embedded OLE object in a mail message from FoxPro for Windows.
MORE INFORMATIONThe FoxPro Extensions come with FOXMAPI.FLL, MAPILIB.PRG, and MAPIERR.PRG.
For more information about the functions used in this example, examine the MAPILIB.PRG file to find the function that is called in MAPILIB.PRG and then see what function MAPILIB.PRG calls in FOXMAPI.FLL. The Help file located in WGTPLATE\APPENDIX\FOXPRO\FOXMAPI.HLP explains what the functions in FOXMAPI.FLL do. ** Unload any library that is in memory. SET LIBRARY TO ** SET THE LIBRARY TO FOXMAPI.FLL SET LIBRARY TO foxmapi.fll ** NOTE: MAPILIB.PRG and MAPIERR.PRG need to be in the same ** directory as this program for things to work properly. ** MAPILIB.PRG calls FOXMAPI.FLL ** Log on to mail and get session handle msession=MAPILIB('LOGON') ** Get info to send ** m.tonames- the e-mail name of the person the message is addressed ** to. ** m.subject- the subject line of the e-mail message. ** m.notetext- the text of the e-mail message. m.tonames="JOHN DOE" m.subject="ATTACH MAIL TEST" m.notetext=SPACE(200) m.position=1 && This position is where to insert object m.pathname="c:\windows\cars.bmp" && Path and file of OLE object m.filename="" && Indicates to use pathname ** create mapiRecip cursor ** resolve name ** The MapiRecip cursor contains information about a message ** originator or recipient. =MAPILIB('resolve',msession,m.tonames) ** Create mapiFile and mapiMesg cursors. ** mapiFile contains information about a file attachment. ** mapiMesg contains information about a message. ** See the help file for more information. =MAPILIB('newcursor','mapiFile') =MAPILIB('newcursor','mapiMesg') ** Insert the needed information. INSERT INTO mapiFile VALUES(0,0,1,m.pathname,m.filename,; "") INSERT INTO mapiMesg VALUES(0,m.subject,m.notetext,'IPM.',; MAPILIB('getdate'),'',0,RECCOUNT('mapiRecip'),1) retval=mapilib("sendmail",msession,"mapiMesg","mapiRecip",; "mapiFile",0) ** Log off and cleanup ** Logging off by directly calling the mplogoff function in ** FOXMAPI.FLL =MPLogoff(msession,0,0,0) CLEAR ALL CLOSE ALL RELEASE ALL SET LIBRARY TO ** END OF PROGRAM Additional query words: FoxWin 2.50 mapi ext email Keywords : kbcode FxinteropOle Version : 2.50 2.50a 2.50b Platform : WINDOWS Issue type : |
Last Reviewed: August 11, 1999 |