Search code examples
asp.netimapgmail-imaplumisoft

Getting exception in reading mails from Gmail IMAP server using Lumisoft


I have developed web application which is reading mails from Gmail IMAP server and I have used Lumisoft.Net for this.

With my account everything is working just fine but with my client's account it's throwing this error:

System.Exception: Read length can't be bigger than source string !
   at LumiSoft.Net.IMAP.Client.IMAP_Client.Fetch(Boolean uid, IMAP_t_SeqSet seqSet, IMAP_t_Fetch_i[] items, EventHandler`1 callback)
   at GetOutput.Page_Load(Object sender, EventArgs e)

I am getting this exception from the following code

if (folder.FolderName.Contains("All Mail"))
{    
imap.SelectFolder(folder.FolderName);
    imap.Fetch(
                                    false,
                                    IMAP_t_SeqSet.Parse("1:*"),
                                    new IMAP_t_Fetch_i[]{
                                    new IMAP_t_Fetch_i_Envelope(),
                                    new IMAP_t_Fetch_i_Flags(),
                                    new IMAP_t_Fetch_i_InternalDate(),
                                    new IMAP_t_Fetch_i_Rfc822Size(),
                                    new IMAP_t_Fetch_i_Uid()
                                },
                                    this.m_pImap_Fetch_MessageItems_UntaggedResponseInbox
                                );
}

I am big trouble due to this so please anyone can help me then it will be really great. Please help me.

Thanks, Anvesh


Solution

  • m_pImap.SelectFolder(folder);
    //m_pImap.Search(false, "UTF-8", "UNSEEN");
    
    // Start fetching.
    m_pImap.Fetch(
        false,
        IMAP_t_SeqSet.Parse("1:*"),
        new IMAP_t_Fetch_i[]{
            //new IMAP_Search_Key_Unseen(),
            new IMAP_t_Fetch_i_Envelope(),
            new IMAP_t_Fetch_i_Flags(),
            new IMAP_t_Fetch_i_InternalDate(),
            new IMAP_t_Fetch_i_Rfc822Size(),
            new IMAP_t_Fetch_i_Uid()
        },
    
        this.m_pImap_Fetch_MessageItems_UntaggedResponse
    );