We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Error while connecting IMAP Account

Hi Team,

We get a message “Value does not fall within the expected range”, when our application tries to connect to IMAP account using Aspose.Mail API.

Can you please help us in letting know, when and why do we get this error message ?


Hi Ame,

Thank you for writing to Aspose support team.

I have checked the functionality of ImapClient using latest library Aspose.Email for .NET 17.4.0 and observed no issue while accessing my test account. Could you please give a try to the following sample code with the latest library and share the feedback? If problem is not resolved, please share your sample code along with the temporary credentials of test account on the said server. It will help us to observe the problem and provide assistance accordingly.

static void Main(string[] args)
    ImapClient client = GetImapClient();
    ImapMessageInfoCollection messageInfoCol = client.ListMessages();
    Console.WriteLine("Press any key to continue...");

static public ImapClient GetImapClient()
    ImapClient imap = new ImapClient("imap.gmail.com", 993, "user@gmail.com", password");
    imap.SecurityOptions = SecurityOptions.Auto;
    return imap;