Peoplesoft PT_MCF_MAIL: MCFmailpart() and body part() is sending duplicate files with extra 1

Narendra R-Oracle
Narendra R-Oracle Orion GCS Customer Posts: 1 Green Ribbon

I have 3 files and used PT_MCF_MAIL: MCFmailpart() and body part() , it is sending 4 files the last file is getting attached 2 times to the mail.

following is the code


import PT_MCF_MAIL:*;

import PT_MCF_MAIL:MCFOutboundEmail;

import PT_MCF_MAIL:MCFEmail;


Local PT_MCF_MAIL:MCFOutboundEmail &email = create PT_MCF_MAIL:MCFOutboundEmail();

Local PT_MCF_MAIL:MCFBodyPart &text = create PT_MCF_MAIL:MCFBodyPart();

  While files <> null

   Local PT_MCF_MAIL:MCFBodyPart &attach = create PT_MCF_MAIL:MCFBodyPart();

   If &demo_I = 1 Then;

     Local PT_MCF_MAIL:MCFMultipart &mp = create PT_MCF_MAIL:MCFMultipart();

     &multiattach = CreateArray(&attach);

end-if;

  &multiattach [&demo_I] = &attach;

   &multiattach [&demo_I].SetAttachmentContent(&demo_FILE_PATH_NAME, %FilePath_Absolute, &demo_FILE_NAME, "", "", "");

   &multiattach [&demo_I].Disposition = "attachment";

 &mp.AddBodyPart(&multiattach [&demo_I]);

   &demo_I = &demo_I + 1;

  End-While;

  &mp.AddBodyPart(&text);

  &mp.AddBodyPart(&attach);

  &email.MultiPart = &mp;

---------------

Below code is sending one duplicate file is attaching again which is coming at last file