IMAP processing of mail header References with multiple msgids

+1 vote
asked May 11, 2010 by Scott Waye (200 points)
edited Mar 27, 2011

Hi,

Using Rebex.Net.Imap 1.0.3723.0, .Net 3.5 VS2010

Seems that Outlook 12.0 does not enclose the msgids in the References mail header with angle brackets, so when the header is parsed, the MessageIdCollection contains one item with a value of all the message ids. It should have one value for each msgid. Example section of message header:

References: 1468@dm.hubse.hubsedev 1470@dm.hubse.hubsedev
In-Reply-To: 1470@dm.hubse.hubsedev
Subject: RE: Tuesday Test Message
Date: Tue, 11 May 2010 18:16:05 +0100
Message-ID: <004c01caf12d$a42d3950$ec87abf0$@bridges@hubse.com>
MIME-Version: 1.0
Content-Type: multipart/alternative;
        boundary="----=_NextPart_000_004D_01CAF136.05F1A150"
X-Mailer: Microsoft Office Outlook 12.0

I have to put a workaround in my code to handle this as the standard parsing of the References header does not cater for this. My code is like this:

foreach(MimeHeader header in mailMessage.Headers)
{
    if(header.Value is MessageIdCollection)
    {
        var messageIds = header.Value as MessageIdCollection;
        foreach(MessageId id in messageIds)
        {
            // Seems like Outlook does not put <> around the Ids so they appear as one id with a space.  Use this Contains and Split to workaround
            if(id.Id.Contains(" "))
            {
                var parts = id.Id.Split(' ');
                foreach(var part in parts.Where(part =>!String.IsNullOrEmpty(part)))
                {
                    // process header using part
                }
            }
            else
            {
                // process header normally
            }
        }
    }
}

My question is, as Outlook as a very common mail client, even if it does not comply with the RFC, should there not be support for this form of header in Rebex? Or have a missed something?

Thanks.

Scott

Applies to: Rebex Secure Mail

2 Answers

0 votes
answered May 12, 2010 by Lukas Pokorny (97,590 points)
edited May 12, 2010

We usually try to support common mail clients even if they don't comply with RFCs, but no one reported this particular issue so far. Even though, it looks like adding a workaround for this would be safe and not break anything. We will try to add this into the next release.

However, we are not able to reproduce the behavior described. This is what I tried:

  1. I used Outlook 12 (connected to MS Exchange 2007) to send an e-mail to my Gmail account.
  2. I replied several times at each side.
  3. I downloaded the message from the Exchange server using Rebex IMAP
  4. I checked the headers of the downloaded message and found a perfectly valid References header (with angle brackets).

It looks like the problem is not caused by Outlook 12 alone. If possible, please let us know how to reproduce this behavior.

commented May 12, 2010 by Scott Waye (200 points)
I was connecting to an SMTP server to reply from Outlook. I will try with an Exchange server as you have done and report back
0 votes
answered Oct 23, 2010 by AlexKR (140 points)
edited Oct 23, 2010

In this case I would advise to use the Inet, but I found out there the same thing, which would be help in this situation. Some weeks ago I used it and my troubles have been gone - repair outlook.

...