Example #1
0
        public static List <string> CheckMailbox(string HOST, int PORT, string USER, string PASS, string strTemp, List <string> UIDL, int counter)
        {
            var client = new ClientGrazyna(HOST, PORT);


            client.WriteAndPrintIntoConsole("USER " + USER);
            client.WriteAndPrintIntoConsole("PASS " + PASS);

            client.Write("LIST");
            var responseMultiline = client.ReadMessage().Split('\n');

            foreach (var line in responseMultiline)
            {
                UIDL.Insert(0, counter.ToString());
                string[] strarr = line.Split(' ');
                if (strarr.Length == 2)
                {
                    UIDL.Remove(counter.ToString());
                    if (!UIDL.Contains(strarr[1]))
                    {
                        UIDL.Add(strarr[1]);
                        Console.WriteLine("Check your mailbox.");
                        counter++;
                        UIDL.Insert(0, counter.ToString());
                    }
                }
            }
            return(UIDL);
        }
Example #2
0
        public static List <string> ReadMailbox(string HOST, int PORT, string USER, string PASS, string strTemp, List <string> UIDL)
        {
            var client = new ClientGrazyna(HOST, PORT);

            client.WriteAndPrintIntoConsole("USER " + USER);
            client.WriteAndPrintIntoConsole("PASS " + PASS);

            client.Write("LIST");
            var responseMultiline = client.ReadMessage().Split('\n');

            foreach (var line in responseMultiline)
            {
                string[] strarr = line.Split(' ');
                Console.WriteLine(strarr[0]);
                if (strarr.Length == 2)
                {
                    UIDL.Add(strarr[1]);
                    Console.WriteLine(strarr[1]);
                }
            }
            return(UIDL);
        }