
Help - Want to add attachment to mapi email
I'm a newbie when it comes to mapi, and I am trying to do a send to and add
an
attachment to the mail message. Here is the test code I am using
MAPISession1.DownLoadMail = False
MAPISession1.SignOn
MAPIMessages1.SessionID = MAPISession1.SessionID
MAPIMessages1.MsgIndex = -1
MAPIMessages1.Compose
MAPIMessages1.AttachmentIndex = 1
MAPIMessages1.AttachmentPathName = AValidPathName
MAPIMessages1.AttachmentName = "test.txt"
MAPIMessages1.AttachmentType = mapData
MAPIMessages1.Send True
MAPISession1.SignOff
If I don't add the attachment, my email window comes up and I can compose
and send, so the mapi
stuff is basically working. With the code above, I get Mapi error 32011 -
Attachment not found.
I know the file I exists, so there must be something I am missing here. I've
tried moving the
order of the method calls around, inserting a small string in the msg first
and then
specifiying the attachment position. Always get the same response - can't
find the attachment.
Can anybody help?
Thanks,
Peter