pmengal / MailSystem.NET

Great email library for C#.
GNU Lesser General Public License v3.0
268 stars 136 forks source link

imap4 exception - NO the specified message set is inavlid #20

Open maddisn opened 7 years ago

maddisn commented 7 years ago

For some odd reason the moveMessage method fails, it only moves a couple of emails and fails to finish the job.

I have been fighting this issue for over 2 weeks, and this is an important feature of my application. I tried this method with both gmail and outlook, but it still fails.

` public void EnsureMessagesCanBeMoved() { var _selectedMailBox = "Inbox"; var _targetMailBox = "Processed"; Mailbox finalMailbox;

        using (var client = new Imap4Client())
        {
            client.ConnectSsl("imap.gmail.com", 993);
            client.Login("secret", "secret");

            Mailbox mails = client.SelectMailbox(_selectedMailBox);
            var mailMessages = mails.Search("ALL");

            foreach(var x in mailMessages)
            {
                mails.MoveMessage(x, _targetMailBox);
            }

            finalMailbox = client.SelectMailbox("Processed");
            client.Disconnect();
        }

        Assert.AreEqual(15, finalMailbox.MessageCount);
    }

`

This test fails.