Fix for EXPUNGE method

Feb 12, 2009 at 12:11 PM

1. Thanks for providing this handy library.
2. Below is a fix for the EXPUNGE method in the file ImapCommand.cs

// Add this new constant string at the top of the file:
const string patExpungeComplete = @"^kw\d+\WOK\W([Ee][Xx][Pp][Uu][Nn][Gg][Ee]\W|)[Cc][Oo][Mm][Pp][Ll][Ee][Tt][Ee]";

// The fix is in the WHILE statement below:
public void Expunge()
if (!(Connection.ConnectionState == ConnectionState.Open))

string response;
response = Connection.Read();
} while (!(response.EndsWith("))") || Regex.IsMatch(response, patExpungeComplete) || Regex.IsMatch(response, patFetchComplete) || Regex.IsMatch(response, patFetchNotOk)));
I found this while writing a small program to fetch mails from a Microsoft Exchange Server.