BitrixAQA.General.Pop.GetYandexTextTheme C# (CSharp) Method

GetYandexTextTheme() public static method

ищет письмо с нужной темой
public static GetYandexTextTheme ( string userEmail, string Subject, string Password ) : bool
userEmail string email на который стучимся
Subject string Тема письма, которое нужно прочитать
Password string Пароль
return bool
        public static bool GetYandexTextTheme(string userEmail, string Subject, string Password)
        {
            Pop3Client client = new Pop3Client();
            client.Connect("pop.yandex.ru", 995, true);
            client.Authenticate(userEmail.Substring(0, userEmail.IndexOf("@")), Password);

            int messageCount = client.GetMessageCount();
            for (Int32 i = 1; i <= messageCount; i++)
            {
                MessageHeader headers = client.GetMessageHeaders(i);
                RfcMailAddress from = headers.From;
                string subject = headers.Subject;
                //проверяем тему письма, если та что нам надо, добавляем письмо в список писем
                if (subject == Subject)
                    return true;
            }
            return false;
        }