Article ID: 181899
Article Last Modified on 1/27/2005
*-- Attach the files.
FOR lnCount = 1 TO ALEN(lcAttachment)
oMessage.AttachmentIndex = lnCount - 1
oMessage.AttachmentPathName = lcAttachment(lnCount)
ENDFOR
The changes for the code are give below:
*-- Attach the files.
FOR lnCount = 1 TO ALEN(lcAttachment)
oMessage.AttachmentIndex = lnCount - 1
oMessage.AttachmentPathName = lcAttachment(lnCount)
*-- We have to increment the AttachmentPosition because two
*-- attachments cannot occupy the same space.
*-- The AttachmentPosition dictates the character position of the
*-- attachment, so stick them in after the message.
oMessage.AttachmentPosition = lnCount - 1
ENDFOR
oSession = CREATEOBJECT("MSMapi.MapiSession")
oMessage = CREATEOBJECT("MSMapi.MapiMessages")
oSession.LogonUI = .t.
oSession.SignOn
*-- The message control needs to reference the session control's ID.
oMessage.SessionID = oSession.SessionID
oMessage.MsgIndex = -1
*-- Set up our message and send it.
oMessage.Compose
oMessage.msgsubject = "Attachments sent using FoxPro and MAPI"
oMessage.msgnotetext = " Attached are some test files."
*-- Create an array holding the attachment file names.
DIMENSION lcAttachment(2)
lcAttachment(1) = home()+ "samples\data\customer.dbf"
lcAttachment(2) = home()+ "samples\data\customer.cdx"
*-- Attach the files.
FOR lnCount = 1 TO ALEN(lcAttachment)
oMessage.AttachmentIndex = lnCount - 1
oMessage.AttachmentPathName = lcAttachment(lnCount)
ENDFOR
*-- Send the message on its way.
oMessage.send(1)
136638 How to send e-mail programmatically by using MSMAPI OLE control
Additional query words: MSMAPI MAPI OCX
Keywords: kbprb KB181899