This is a C# source code that generates an unencrypted AS2 message with a request for an MDN.  The complete program can be downloaded at EDIINT AS2
A detailed explanation of the algorithm can be read at "Creating an AS2 client in stages".


private void btnPlainMdn_Click(object sender, EventArgs e)
        {
            
            ediDocument oEdiDoc = null;
            mailDocument oMailDoc = null;
            mailMessage oMailSubject = null;
            bool bSyncronous = true;

            string sPath = AppDomain.CurrentDomain.BaseDirectory;

            oEdiDoc = new ediDocument();

            //object for AS2 file
            oMailDoc = oEdiDoc.GetMailDocument();

            //Setting so that syntax for the field "Disposition-Notification-To" is not validated, but treated as a free form text field
            oMailDoc.AddDefinedHeader("Disposition-Notification-To", MailMessageHeaderTypeConstants.HeaderType_FieldText, RequirementTypeConstants.Requirement_Optional);

            //oject for subject/content in AS2 file
            oMailSubject = oMailDoc.GetMessageContent();

            //Create headers in the order you want them displayed
            // Put globally unique ID as Message-ID.
            oMailSubject.set_HeaderFieldValue("Message-ID", "1234567890@evalusercompany.com");  //txtMessageID.Text
            // Put AS2 version.
            oMailSubject.set_HeaderFieldValue("AS2-Version", "1.0");
            // Put AS2-To header value.
            oMailSubject.set_HeaderFieldValue("AS2-To", "ToCompanyABC");
            // Put AS2-From header value.
            oMailSubject.set_HeaderFieldValue("AS2-From", "FromCompanyXYZ");

            // MDN can be requested to be sent by the following ways:
            //  - Synchronously - use the same connection to receive the MDN that was used to send the AS2 message. 
            //  - Asynchronously - use a different connection to receive the MDN.  
            if (!bSyncronous) // asyschronous
            {
                // For asynchronous MDN, you must set a syntactically correct URI to header 'Receipt-delivery-option'.
                oMailSubject.set_HeaderFieldValue("Receipt-delivery-option", "http://domain.com:9999/testsite/AsyncMDN/");
            }
            else
            {
                // Request MDN Acknowledgment by adding a "Disposition-Notification-To" header.
                // Value must be present when requesting for MDN, but holds no meaning in an AS2 environment.
                oMailSubject.set_HeaderFieldValue("Disposition-Notification-To", "<evaluser@evalusercompany.com>");
            }

            //add appropriate header to describe the content
            //  - "Application/EDI-X12" for EDI X12
            //  - "Application/EDIFACT" for EDI UN/EDIFACT
            //  - "Application/XML" for XML
            oMailSubject.set_HeaderFieldValue("Content-Type", "Application/EDI-X12");

            //the content to be sent in this AS2 message is an EDI X12 file.  The file is imported into the message object.
            oMailSubject.Import(sPath + "ediFile.X12");

            //This is the file that you would send by http or https
            oMailDoc.Save(sPath + @"\MailFolder\AS2PlainTextMdnRequest.bin");

            TransmitFileByHttp(ref oMailDoc, "AS2PlainTextMdnRequest.bin");

            if (bSyncronous) // MDN syschronous
            {
                mailMessage oMDN = oMailDoc.GetMDN();
                oMDN.Save(sPath + @"MailFolder\Received_MDN.bin");  //This is the MDN received syncronously
                ReadMdnMessage(ref oMDN);
                oMDN.Dispose();
            }
            else // MDN asyschronous
            {
                mailMessage oMDN = new mailMessage();
                oMDN.Import(sPath + @"MailFolder\Received_MDN.bin");
                ReadMdnMessage(ref oMDN);
                oMDN.Dispose();

            } // if (bSyncronous)

            oMailSubject.Dispose();
            oMailDoc.Dispose();
            oEdiDoc.Dispose();

            MessageBox.Show("Done");

        }
        

    Click here to evaluate the Framework EDI