PowerBuilder: MAPI, sending multiple attachment files

Everything with sending e-mail using the Pb MAPI mailobjects works fine, even with (one) attachment.

EXCEPT, when sending more-than one attachment file, then sendmail returns FAILURE.

I just fill the mailmessage.attachmentfile[] array, like in the pb-examples.

Help me!
Who is Participating?
Here's a couple of suggestions I found. Let me know if any help.


You need to set the Position property  of the attachment - contrary to what the online help says, this is not read-only.  Set it to 0 for the first attachment, 1 for the second, and so on.


Use the mailFileDescription object.
like this;
MailFileDescription  mAttach
MailMessage          mMsg
STRING                ls_destination, ls_filename
INT                        li_count
....some preprocess for mMsg
// describe the attachment
mAttach.FileType = mailAttach!
mAttach.PathName = ls_destination
mAttach.FileName = ls_filename
// position in text
mAttach.Position = len(mMsg.notetext) - 1
// count to next position
li_count ++
// set the attachment
mMsg.AttachmentFile[li_count] = mAttach


sulfurAuthor Commented:
Thanks David it works!!!!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.