Esempio n. 1
0
        private void DeleteMessage(int messageNumber)
        {
            using (Pop3Client client = new Pop3Client())
            {
                // Connect to the server
                client.Connect(host, port, false);

                // Authenticate ourselves towards the server
                client.Authenticate(mailServerUserName, mailServerPassword, AuthenticationMethod.UsernameAndPassword);

                client.DeleteMessage(messageNumber);

                client.Disconnect();
            }
        }
Esempio n. 2
0
        public Dictionary <int, Message> FetchAllMessages()
        {
            var result = new Dictionary <int, Message>();

            using (Pop3Client client = new Pop3Client())
            {
                client.Connect(host, port, false);

                client.Authenticate(mailServerUserName, mailServerPassword, AuthenticationMethod.UsernameAndPassword);

                int messageCount = client.GetMessageCount();

                for (int i = messageCount; i > 0; i--)
                {
                    result.Add(i, client.GetMessage(i));
                }
            }

            return(result);
        }