Search code examples
c#emailimapinterimap

InterIMAP, Viewing UNREAD IMAP mail and Downloading Attachments in C#


I was wondering if anyone can help me on this cause its driving me mad trying get this working

I was working with the trail of mail.dll from http://www.lesnikowski.com/mail/ which is an extremely fantastic tool which unfortunately i cannot afford being a student (even though its around 150eur, its still very expensive to me :/) and this would be a small module in my thesis and my faculty cannot afford to buy these things for students either :/ so anyway I had to go for a free tool (so please dont suggest any non open source ones - trust me i have tried them ALL)..

Well, i'm trying to explore InterIMAP, and for several hours have been trying to list unread emails from my gmail account but it just doesn't seem to be working. I can connect just fine but finding the unread emails seems to be no easy task.. I have tried countless approaches but non seem to give me unread emails in my inbox (I have loads of emails in my inbox and i just want the unread ones). Would someone please assist me? I have been trying to get this working for ages now, but documentation is rather lacking and my every attempt has resulted in a fail so far.

Please help!!

Some code i currently have: ` IMAPConfig config = new IMAPConfig("myhost", "username", "pass", true, true, "");

        config.CacheFile = "";

        IMAPClient client = null;
        try
        {
            client = new IMAPClient(config, null, 5);
        }
        catch (IMAPException e)
        {
            Console.WriteLine(e.Message);
            return;
        }
        Console.WriteLine(DateTime.Now.ToString());


        IMAPFolder f = client.Folders["INBOX"];
        IMAPSearchResult sResult = f.Search(IMAPSearchQuery.QuickSearchNew()); // <--- Gives me no results even though i do have unread messages!

Solution

  • I honestly just ended up using Mail.dll trial version as interIMAP was not working properly for me and way to slow because it indexes the emails for some reason :s