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

SendAndReceive() public method

Sends a command to the server and returns a reader capable of receiving line by line.
public SendAndReceive ( ImapCommand command, bool processStatusUpdatesAutomatically = true ) : ImapResponseReader
command ImapCommand The command to issue.
processStatusUpdatesAutomatically bool This param defines whether received status updates will be processed automatically.
return ImapResponseReader
        public ImapResponseReader SendAndReceive(ImapCommand command, bool processStatusUpdatesAutomatically = true)
        {
            Send(command);
            return Receive(processStatusUpdatesAutomatically);
        }

Usage Example

Ejemplo n.º 1
0
        private bool AuthenticateLogin(NetworkCredential credentials)
        {
            var text    = string.Format("LOGIN {0} {1}", credentials.UserName, credentials.Password);
            var command = new ImapCommand(text);
            var reader  = _client.SendAndReceive(command);

            while (!reader.IsCompleted)
            {
                reader = _client.Receive(false);
            }
            return(reader.IsOk);
        }