Read Receipts, Delivery Receipts, Send on Behalf of with MAPI

I couldn't find anywhere to write a specific document on this so i figured I'd start it here till i found out where you post this stuff.

There was this puzzling feature we needed over here at our company. We spent numerous amount of time looking for this, not getting much help on the forums, i finally figured it out and figured i'd share it. If you already knew this sorry, if not i hope this helps.

Well here's the example i used.

DO WITH FRAME {&FRAME-NAME}:
    
    DEFINE VARIABLE attach-name  AS CHARACTER    NO-UNDO.
    DEFINE VARIABLE Folder       AS COM-HANDLE   NO-UNDO.
    DEFINE VARIABLE MailItem     AS COM-HANDLE   NO-UNDO.
    DEFINE VARIABLE message-text AS CHARACTER    NO-UNDO.
    DEFINE VARIABLE NameSpace    AS COM-HANDLE   NO-UNDO.
    DEFINE VARIABLE Outlook      AS COM-HANDLE   NO-UNDO.
    

    CREATE "Outlook.Application" Outlook.
        
    ASSIGN 
        NameSpace   = Outlook:GetNameSpace("MAPI":U)
        Folder      = NameSpace:GetDefaultFolder(6)
        attach-name = scr-Attach:SCREEN-VALUE.

    ASSIGN 
        MailItem            = Folder:Items:Add()
        MailItem:To         = TRIM(scr-To:SCREEN-VALUE)
        MailItem:Subject    = TRIM(scr-Subject:SCREEN-VALUE)
        MailItem:Body       = TRIM(ed-Body:SCREEN-VALUE)
        MailItem:CC         = TRIM(scr-CC:SCREEN-VALUE)
        MailItem:Bcc        = TRIM(scr-BCC:SCREEN-VALUE)
        MailItem:Importance = rs-priority:SCREEN-VALUE.
    

    /* This is for Delivery Receipts */
    MailItem:OriginatorDeliveryReportRequested = True. /* Logical */

    /* This is for Read Receipts */
    MailItem:ReadReceiptRequested              = True. /* LOGical */
                   
    /* This is to send on behalf */
    MailItem:SentOnBehalfOfName = scr-BehalfOf:SCREEN-VALUE. /*String Email*/
        
    
    MAilItem:Attachments:ADD(attach-name).
    
    MailItem:SEND().

    RELEASE OBJECT MailItem  NO-ERROR.
    RELEASE OBJECT Folder    NO-ERROR.
    RELEASE OBJECT NameSpace NO-ERROR.
    RELEASE OBJECT Outlook   NO-ERROR.

END.

END PROCEDUR