Пример #1
0
        protected override void FetchCapabilities()
        {
            var command = new Pop3Command("CAPA");
            var reader  = SendAndReceive(command);

            ServerCapability = reader.ReadCapability();
        }
Пример #2
0
        public Pop3ResponseReader SendAndReceive(Pop3Command command)
        {
            Arguments.VerifyNotNull(command);

            Send(command);
            return(Receive());
        }
Пример #3
0
        private bool AuthenticateLogin(NetworkCredential credentials)
        {
            var text    = string.Format("AUTH LOGIN {0} {1}", credentials.UserName, credentials.Password);
            var command = new Pop3Command(text);

            return(_client.SendAndReceive(command).IsPositive);
        }
Пример #4
0
        private UidlPop3Response UidlInternal(Pop3Command command, bool isSingle)
        {
            Arguments.VerifyNotNull(command);

            var reader   = SendAndReceive(command);
            var response = new UidlPop3Response(isSingle);

            response.ReadResponse(reader);
            return(response);
        }
Пример #5
0
        private bool AuthenticatePlain(NetworkCredential credentials)
        {
            var username = credentials.UserName;
            var password = credentials.Password;

            var auth        = username + "\0" + username + "\0" + password;
            var encodedAuth = Base64Encoder.Encode(auth);

            var text    = string.Format("AUTH PLAIN {0}", encodedAuth);
            var command = new Pop3Command(text);

            return(_client.SendAndReceive(command).IsPositive);
        }
Пример #6
0
        private bool AuthenticateCramMd5(NetworkCredential credentials)
        {
            var command  = new Pop3Command("AUTH CRAM-MD5");
            var response = _client.SendAndReceive(command);

            // don't trim the last plus !!
            var base64    = response.CurrentLine.TrimStart(Characters.Plus).Trim();
            var challenge = Base64Encoder.Decode(base64, Encoding.UTF8);

            var username = credentials.UserName;
            var password = credentials.Password;

            var hash = CramMd5Hasher.ComputeHash(password, challenge);

            var authentication = username + " " + hash;
            var authCommand    = new Pop3Command(Base64Encoder.Encode(authentication));

            _client.Send(authCommand);
            return(_client.Receive().IsPositive);
        }
Пример #7
0
        private UidlPop3Response UidlInternal(Pop3Command command, bool isSingle)
        {
            Arguments.VerifyNotNull(command);

            var reader = SendAndReceive(command);
            var response = new UidlPop3Response(isSingle);
            response.ReadResponse(reader);
            return response;
        }
Пример #8
0
 protected override void FetchCapabilities()
 {
     var command = new Pop3Command("CAPA");
     var reader = SendAndReceive(command);
     ServerCapability = reader.ReadCapability();
 }
Пример #9
0
        public Pop3ResponseReader SendAndReceive(Pop3Command command)
        {
            Arguments.VerifyNotNull(command);

            Send(command);
            return Receive();
        }
Пример #10
0
        public void Send(Pop3Command command)
        {
            Arguments.VerifyNotNull(command);

            WriteLine(command.Text);
        }
Пример #11
0
        public void Send(Pop3Command command)
        {
            Arguments.VerifyNotNull(command);

            WriteLine(command.Text);
        }
Пример #12
0
        private bool AuthenticatePlain(NetworkCredential credentials)
        {
            var username = credentials.UserName;
            var password = credentials.Password;

            var auth = username + "\0" + username + "\0" + password;
            var encodedAuth = Base64Encoder.Encode(auth);

            var text = string.Format("AUTH PLAIN {0}", encodedAuth);
            var command = new Pop3Command(text);
            return _client.SendAndReceive(command).IsPositive;
        }
Пример #13
0
 private bool AuthenticateLogin(NetworkCredential credentials)
 {
     var text = string.Format("AUTH LOGIN {0} {1}", credentials.UserName, credentials.Password);
     var command = new Pop3Command(text);
     return _client.SendAndReceive(command).IsPositive;
 }
Пример #14
0
        private bool AuthenticateCramMd5(NetworkCredential credentials)
        {
            var command = new Pop3Command("AUTH CRAM-MD5");
            var response = _client.SendAndReceive(command);

            // don't trim the last plus !!
            var base64 = response.CurrentLine.TrimStart(Characters.Plus).Trim();
            var challenge = Base64Encoder.Decode(base64, Encoding.UTF8);

            var username = credentials.UserName;
            var password = credentials.Password;

            var hash = CramMd5Hasher.ComputeHash(password, challenge);

            var authentication = username + " " + hash;
            var authCommand = new Pop3Command(Base64Encoder.Encode(authentication));

            _client.Send(authCommand);
            return _client.Receive().IsPositive;
        }