Crystalbyte.Equinox.Imap.ImapClient.Subscribe C# (CSharp) Method

Subscribe() public method

The SUBSCRIBE command adds the specified mailbox name to the server's set of "active" or "subscribed" mailboxes as returned by the LSUB command. http://tools.ietf.org/html/rfc3501#section-6.3.6
public Subscribe ( string mailboxName ) : ImapResponse
mailboxName string The name of the mailbox to subscribe to.
return ImapResponse
        public ImapResponse Subscribe(string mailboxName)
        {
            // we need to convert non ASCII names according to IMAP specs.
            // http://tools.ietf.org/html/rfc2060#section-5.1.3
            var name = MailboxNameEncoder.Encode(mailboxName);

            var text = string.Format("SUBSCRIBE \"{0}\"", name);
            var command = new ImapCommand(text);
            var reader = SendAndReceive(command);

            var response = new ImapResponse();
            response.Parse(reader);
            return response;
        }