Skip to main content

[Migrated content. Thread originally posted on 21 February 2006]

When sending emails with attachments using MSMAPI32, I get an error and the software crashes just before the screen is destroyed.

I even receive the mails, even when files, just before sending are being zipped.

What can be the problem ?



       MAIN-LOGIC.
           DISPLAY Floating GRAPHICAL WINDOW
                 LINES 16, SIZE 30, CELL HEIGHT 10,
                 CELL WIDTH 10, COLOR IS 65793, LABEL-OFFSET 0,
                 LINK TO THREAD, MODELESS, NO SCROLL, WITH SYSTEM MENU,
                 TITLE "Lucas E-mail...", TITLE-BAR, USER-GRAY,
                 USER-WHITE, NO WRAP,
      *           EVENT PROCEDURE Form2-Event-Proc,
                 HANDLE IS FORM1-HANDLE.

           DISPLAY MyMapi UPON FORM1-HANDLE.
           PERFORM BEPAAL-TOTAL-SIZE.

           IF TOTAL-SIZE > 1000
              PERFORM ZIP-FILES.

           PERFORM BEPAAL-NUMBER-OF-FILES.

            MODIFY  MySession        DownloadMail = 0.
           MODIFY  MySession        SignOn().
            INQUIRE MySession        SessionID IN MySessID.
           MODIFY  MyMessage        SessionID = MySessID.
            MODIFY  MyMessage        Compose().

           MODIFY  MyMessage
                   MsgSubject     = "Gevraagde bestanden"
                   MsgNoteText    = "In bijlage de gevraagde bestanden".

           PERFORM VARYING FILE-IDX FROM 1 BY 1
           UNTIL FILE-IDX > NUMBER-OF-FILES
              INQUIRE MyMessage        AttachmentCount in AIndex
              MODIFY  MyMessage
                      AttachmentIndex    = AIndex
                      AttachmentPosition = FILE-IDX
                      AttachmentType     = mapData
                      AttachmentPathName = FILE-TO-SEND(FILE-IDX)
           END-PERFORM.

           MODIFY  MyMessage        RecipIndex = 0.
           MODIFY  MyMessage        RecipType = mapToList.
           MODIFY  MyMessage        RecipAddress = "Hans@allbiz.be"
                   RecipDisplayName = "Hans"
                   MsgType          = "SMTP".

            MODIFY  MyMessage        @Send().
           MODIFY  MySession        SignOff().

           DESTROY MyMapi.
       MAIN-LOGIC-END.
           EXIT PROGRAM.

[Migrated content. Thread originally posted on 21 February 2006]

When sending emails with attachments using MSMAPI32, I get an error and the software crashes just before the screen is destroyed.

I even receive the mails, even when files, just before sending are being zipped.

What can be the problem ?



       MAIN-LOGIC.
           DISPLAY Floating GRAPHICAL WINDOW
                 LINES 16, SIZE 30, CELL HEIGHT 10,
                 CELL WIDTH 10, COLOR IS 65793, LABEL-OFFSET 0,
                 LINK TO THREAD, MODELESS, NO SCROLL, WITH SYSTEM MENU,
                 TITLE "Lucas E-mail...", TITLE-BAR, USER-GRAY,
                 USER-WHITE, NO WRAP,
      *           EVENT PROCEDURE Form2-Event-Proc,
                 HANDLE IS FORM1-HANDLE.

           DISPLAY MyMapi UPON FORM1-HANDLE.
           PERFORM BEPAAL-TOTAL-SIZE.

           IF TOTAL-SIZE > 1000
              PERFORM ZIP-FILES.

           PERFORM BEPAAL-NUMBER-OF-FILES.

            MODIFY  MySession        DownloadMail = 0.
           MODIFY  MySession        SignOn().
            INQUIRE MySession        SessionID IN MySessID.
           MODIFY  MyMessage        SessionID = MySessID.
            MODIFY  MyMessage        Compose().

           MODIFY  MyMessage
                   MsgSubject     = "Gevraagde bestanden"
                   MsgNoteText    = "In bijlage de gevraagde bestanden".

           PERFORM VARYING FILE-IDX FROM 1 BY 1
           UNTIL FILE-IDX > NUMBER-OF-FILES
              INQUIRE MyMessage        AttachmentCount in AIndex
              MODIFY  MyMessage
                      AttachmentIndex    = AIndex
                      AttachmentPosition = FILE-IDX
                      AttachmentType     = mapData
                      AttachmentPathName = FILE-TO-SEND(FILE-IDX)
           END-PERFORM.

           MODIFY  MyMessage        RecipIndex = 0.
           MODIFY  MyMessage        RecipType = mapToList.
           MODIFY  MyMessage        RecipAddress = "Hans@allbiz.be"
                   RecipDisplayName = "Hans"
                   MsgType          = "SMTP".

            MODIFY  MyMessage        @Send().
           MODIFY  MySession        SignOff().

           DESTROY MyMapi.
       MAIN-LOGIC-END.
           EXIT PROGRAM.
Forgot the error.jpg

[Migrated content. Thread originally posted on 21 February 2006]

When sending emails with attachments using MSMAPI32, I get an error and the software crashes just before the screen is destroyed.

I even receive the mails, even when files, just before sending are being zipped.

What can be the problem ?



       MAIN-LOGIC.
           DISPLAY Floating GRAPHICAL WINDOW
                 LINES 16, SIZE 30, CELL HEIGHT 10,
                 CELL WIDTH 10, COLOR IS 65793, LABEL-OFFSET 0,
                 LINK TO THREAD, MODELESS, NO SCROLL, WITH SYSTEM MENU,
                 TITLE "Lucas E-mail...", TITLE-BAR, USER-GRAY,
                 USER-WHITE, NO WRAP,
      *           EVENT PROCEDURE Form2-Event-Proc,
                 HANDLE IS FORM1-HANDLE.

           DISPLAY MyMapi UPON FORM1-HANDLE.
           PERFORM BEPAAL-TOTAL-SIZE.

           IF TOTAL-SIZE > 1000
              PERFORM ZIP-FILES.

           PERFORM BEPAAL-NUMBER-OF-FILES.

            MODIFY  MySession        DownloadMail = 0.
           MODIFY  MySession        SignOn().
            INQUIRE MySession        SessionID IN MySessID.
           MODIFY  MyMessage        SessionID = MySessID.
            MODIFY  MyMessage        Compose().

           MODIFY  MyMessage
                   MsgSubject     = "Gevraagde bestanden"
                   MsgNoteText    = "In bijlage de gevraagde bestanden".

           PERFORM VARYING FILE-IDX FROM 1 BY 1
           UNTIL FILE-IDX > NUMBER-OF-FILES
              INQUIRE MyMessage        AttachmentCount in AIndex
              MODIFY  MyMessage
                      AttachmentIndex    = AIndex
                      AttachmentPosition = FILE-IDX
                      AttachmentType     = mapData
                      AttachmentPathName = FILE-TO-SEND(FILE-IDX)
           END-PERFORM.

           MODIFY  MyMessage        RecipIndex = 0.
           MODIFY  MyMessage        RecipType = mapToList.
           MODIFY  MyMessage        RecipAddress = "Hans@allbiz.be"
                   RecipDisplayName = "Hans"
                   MsgType          = "SMTP".

            MODIFY  MyMessage        @Send().
           MODIFY  MySession        SignOff().

           DESTROY MyMapi.
       MAIN-LOGIC-END.
           EXIT PROGRAM.
Think I got the solution myself.

First : In the screen-section, I put the MySession and MyMessage with the visible property to false.

Second : I destroyed MyMapi in stead of Form1-handle.

No errors anymore :D