+1 vote
by (200 points)
edited

Hi,

I have a problem processing a read receipt using IMAP, relevant versions are:

Rebex: 1.0.3723.0, Thunderbird 3.0.4

When sending a read receipt to Thunderbird, the reply looks like this (I've deleted the domains):

Return-Path: <scott@wxxxxxx>
Delivered-To: thehub@xxxxxx
Received: (qmail 8965 invoked by uid 1018); 11 May 2010 21:55:56 -0000
Delivered-To: hubse-thehub@xxxxxx
Received: (qmail 8962 invoked from network); 11 May 2010 21:55:56 -0000
Received: from localhost (HELO ASSP-nospam) (scott@127.0.0.1)
  by localhost with ESMTPA; 11 May 2010 21:55:56 -0000
Received: from [192.168.2.123] ([192.168.2.123] helo=[192.168.2.123]) with
        IPv4:25 by ASSP-nospam; 11 May 2010 22:55:55 +0100
Date: Tue, 11 May 2010 22:55:54 +0100
From: Scott <scott@xxxxxxxx>
Message-ID: <4BE9D26A.6080101@xxxxxxxx>
Subject: Return Receipt (displayed) - read and del
To: <thehub@xxxxxxx>
References: <1473@dm.hubse.hubsedev>
MIME-Version: 1.0
Content-Type: multipart/report; report-type=disposition-notification;
        boundary="------------mdn050805040105090308090508"

--------------mdn050805040105090308090508
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

This is a Return Receipt for the mail that you sent to scott@xxxxxxxx.

Note: This Return Receipt only acknowledges that the message was displayed on the recipient's computer. There is no guarantee that the recipient has read or understood the message contents.

--------------mdn050805040105090308090508
Content-Type: message/disposition-notification; name="MDNPart2.txt"
Content-Disposition: inline
Content-Transfer-Encoding: 7bit

Reporting-UA: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-GB; rv:1.9.1.9) Gecko/20100317 Thunderbird/3.0.4
Final-Recipient: rfc822;scott@xxxxxxx
Original-Message-ID: <1473@dm.hubse.hubsedev>
Disposition: manual-action/MDN-sent-manually; displayed

--------------mdn050805040105090308090508
Content-Type: text/rfc822-headers; name="MDNPart3.txt"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

Return-Path: <thehub@xxxxxx>
Delivered-To: scott@xxxxxxxx
Received: (qmail 8950 invoked from network); 11 May 2010 21:55:03 -0000
Received: from localhost (HELO ASSP-nospam) (thehub@127.0.0.1)
  by localhost with ESMTPA; 11 May 2010 21:55:03 -0000
Received: from leticia ([192.168.2.123] helo=leticia) with IPv4:25 by
        ASSP-nospam; 11 May 2010 22:55:03 +0100
Disposition-Notification-To: <thehub@xxxxxxxx>
Message-ID: 1473@dm.hubse.hubsedev
MIME-Version: 1.0
From: thehub <thehub@xxxxxxx>
To: scott@xxxxxxxx
Date: 11 May 2010 22:55:03 +0100
Subject: read and del
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: quoted-printable

--------------mdn050805040105090308090508--

When processing this using GetMimeMessage(i), the 3 mime parts are correctly identified, but for the second mime part ContentMessage and ContentString are null. The Headers property contains just the 3 Content- headers as they are followed by a new line on its own. The interesting line begining Original-Message-ID: is not available anywhere. Is this a bug, and if not how can I get the Orinigal-Message-ID line using Rebex IMAP?

Thanks,

Scott

Applies to: Rebex Secure Mail

1 Answer

+2 votes
by (148k points)
edited
 
Best answer

In the current version of Rebex Mail, ContentString only works for "text/something" MIME parts and ContentMessage only works for "message/rfc822" MIME parts. The second MIME part is "message/disposition-notification", so its content must be accessed using GetContentStream method.

Because it's actual content is actually a sub-type of "message", a separate MimeMessage (or MailMessage) can be used to easily parse it:

C# sample code:

    // get the MIME message
    MimeMessage message = imap.GetMimeMessage(...);

    // get the second MIME part's (message/disposition-notification)
    // content stream
    Stream content = message.Parts[1].GetContentStream();

    // initialize a separate MIME message from disposition-notification's
    // content stream
    MimeMessage dispositionNotification = new MimeMessage();
    dispositionNotification.Load(content);

    // retrieve the Original-Message-ID value
    string originalMessageId =
        dispositionNotification.Headers["Original-Message-ID"].Raw;

If you prefer VB.NET, just let us know.

by (200 points)
Thanks, that works well.
...