MessageHeader EmailAddress list not being parsed correctly


Some email addresses are not being parsed correctly in the TO, CC, BCC collections.
In one example the parser cannot break up the 3 addresses on the TO field.
The parsed message returns 1 email address rather than the expected 3 in the TO field collection. The actual result looks like am address string = 'dave@yahoo.com, steve@hotmail.com, brian@gmail.com' and display name = <'dave@yahoo.com, steve@hotmail.com, brian@gmail.com'>. Another side effect is that it also returns an empty email address in the BCC collection.
I'm not sure what the root cause is yet, but I suggest that the Parser checks to ensure that only one @ can exist in an email address. Equally an error should be handled when an email address is empty of poorly formated.


JasonMiesionczek wrote Apr 5, 2010 at 12:17 PM

Which client are you using and seeing this problem, synchronous or asynchronous?

connormurphy wrote Apr 6, 2010 at 4:31 PM

Hi Jason,

I'm using Async. Is that the best version to use? I presumed this was the most up to date version of the code.
Also do you think there will be anymore documentation soon. I'm struggling to find good async examples and I don't want to change libraries :)


JasonMiesionczek wrote Apr 7, 2010 at 6:39 PM

Yeah, the Async client is currently the only supported client.

In regards to your original issue, would you be able to provide the actual text that is returned by the server for the TO, CC, and BCC fields? i would like to see how it looks and make the necessary adjustments to account for this variance.


P.S. I will be adding some more documentation within the next few days as time permits. Is there any specific topic you would like me to cover?

connormurphy wrote Apr 12, 2010 at 4:13 PM

Hi Jason,

I'm trying to reproduce it right now but I'm having difficulties connecting to Gmail using the newer Async methods.
Could you post an end to end example where a user would connect to Gmail, and return a collection of messages for the Inbox and Sent sub folder.
The example would also need to have a query that limited the search using an 'after date' i.e. get me all emails since date X

Once I get that up and working I will be able to send on the specific To,CC, and BCC texts. I've also had bugs around the date format as the odd email data returns null.

Thanks again,

connormurphy wrote Apr 13, 2010 at 9:50 AM

Hi Jason,

Here is how I'm currently trying to connect. It sort of works... but I get some very inconsistent behaviours and the afterdate filter does not appear to work correctly as it usually returns a collection of Null messages. Could you give an example of how to do this correctly using async? This would be really appreciated

    public IMAPMessageCollection getMessages(EmailLogin emailLogin)
        IMAPConfig config = new IMAPConfig("imap.gmail.com", emailLogin.Username, emailLogin.Password, true, true, "");        
        IMAPClient client = null;
        client = GetClient(config, client);

        IMAPMessageCollection collection = new IMAPMessageCollection();
        IMAPSearchQuery query = new IMAPSearchQuery();
        query.AfterDate = emailLogin.LastUpdated.AddMilliseconds(1).ToString();

        IMAPFolder InboxFolder = client.GetSingleFolder("INBOX");
        IMAPFolder SentFolder = client.GetSingleFolder("[Gmail]");
        IMAPFolder SentSubFolder = SentFolder.SubFolders["Sent Mail"];


        return collection;

wrote Feb 14, 2013 at 7:14 PM