PowerBuilder: MAPI, sending multiple attachment files

Posted on 2000-03-20
Last Modified: 2008-02-26
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!
Question by:sulfur
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Accepted Solution

david_levine earned 100 total points
ID: 2636437
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



Author Comment

ID: 2639450
Thanks David it works!!!!

Featured Post

Enroll in June's Course of the Month

June's Course of the Month is now available! Every 10 seconds, a consumer gets hit with ransomware. Refresh your knowledge of ransomware best practices by enrolling in this month's complimentary course for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Let’s face it: one of the reasons your organization chose a SaaS solution (whether Microsoft Dynamics 365, Netsuite or SAP) is that it is subscription-based. The upkeep is done. Or so you think.
In this blog post, we’ll look at how ClickHouse performs in a general analytical workload using the star schema benchmark test.
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
If you’ve ever visited a web page and noticed a cool font that you really liked the look of, but couldn’t figure out which font it was so that you could use it for your own work, then this video is for you! In this Micro Tutorial, you'll learn yo…

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question