Use custom IMAP commands (cyrus)

0 votes
asked Oct 14, 2010 by J. Aho (160 points)
edited Apr 1, 2011

I'm looking for a somewhat useful imap class for C# and I'm looking if I can use Rebex. It seems to have the basics that most users needs, but nothing for administrating an imap server over imap connection (in my case the imap server runs cyrus), at least there is a feature listed as "custom flag" which I believe is what I'm supposed to use, but unsure how to use it to send the administration commands to the server with help of Rebex.

For example we have the following command to set the quota for a mailbox:

. setquota "mailboxname" (STORAGE 10000)

And what about talking about sieve commands? Had been nice to be able to administrate the autoreply messages, if not possible, anyone know any class that already does talk with sieve servers?

Applies to: Rebex Secure Mail

2 Answers

0 votes
answered Oct 15, 2010 by Lukas Pokorny (126,870 points)
edited Oct 15, 2010

Administering an IMAP server over IMAP connection is not covered by the IMAP protocol. We are not sure it would be a good idea to add support for non-trivial proprietary protocol extensions (this doesn't apply to Quota and Sieve commands, of course).

You can use Rebex Imap object to execute simple custom commands. For example, to set quota for a mailbox, use this code:

imap.SendCommand("SETQUOTA", "mailboxname", "(STORAGE 10000)");
ImapResponse response = imap.ReadResponse();
if (response.Code != ImapResponseCode.Ok)
    throw new ImapException(response);

(where imap is an instance of Imap class)

Check out How to get quota of IMAP account question for additional information about quota commands.

It looks like there is an IETF draft document) for Sieve on IMAP and we might look into this for one of the future releases. Thanks for the tip!

0 votes
answered Oct 15, 2010 by J. Aho (160 points)
edited Oct 15, 2010

Thanks, the example was what I was looking for, and thanks for the link too.

It's a bit sad that there isn't sieve support (I kind of knew that, as there is no mentioning about it on the web page), which leads to I have to build something myself, at least I have some php based code to relay on as to what to send, just need to figure out how to work with sockets in C#/Mono.

...