0 votes
by (120 points)
edited

We're using the Rebex.NET.Imap class to manage an IMAP connection and create folders on the IMAP server. When we attempt to create folders on an IMAP server which has not been configured with a default namesapce of "" (currently ".INBOX" and "." exist) the CREATE command fails with "Unknown Namespace".

Is there a way to specify a namespace as part of the Imap.CreateFolder() method?

Applies to: Rebex Secure Mail

1 Answer

0 votes
by (58.9k points)
edited

No it is not possible directly from the CreateFolder method. However, you can use combination of methods SendCommand and ReadResponse.

// Send CREATE command with custom parameters
imap.SendCommand("CREATE", "param1", "param2", ..., "paramN");
ImapResponse response = imap.ReadResponse();

// display server response
foreach (ImapResponseLine line in response.GetLines())
{
    Console.WriteLine(line.Raw);
}
...