Пример #1
0
        //public static MyEvents loggerEvents = new MyEvents();

        //private void Log(string log)
        //{
        //    //EventsArgs args = new EventsArgs(log);
        //    //loggerEvents.LogText(args);
        //}



        public string EmailVerification(string Email, string Password, out bool IsLogin)
        {
            string Host      = string.Empty;
            string InviteUrl = string.Empty;
            int    Port      = 0;

            MailAddress address       = new MailAddress(Uri.UnescapeDataString(Email));
            string      EmailHostName = address.Host.ToLower();

            HostDetails HD = EmailHost.GetHostDetails(EmailHostName);

            Host = HD.Host;
            Port = HD.Port;

            if (!string.IsNullOrEmpty(Host))
            {
                if (popClient.Connected)
                {
                    popClient.Disconnect();
                }
                popClient.Connect(Host, Port, true);
                popClient.Authenticate(Uri.UnescapeDataString(Email), Password.Trim(), AuthenticationMethod.USERPASS);
                int Count = popClient.GetMessageCount();
                IsLogin = true;

                for (int i = Count; i >= 1; i--)
                {
                    OpenPOP.MIME.Message Message = popClient.GetMessage(i);
                    string subject = string.Empty;
                    subject = Message.Headers.Subject;
                    bool contains = subject.IndexOf("Please activate your new Gumtree account", StringComparison.OrdinalIgnoreCase) >= 0;

                    if (contains)
                    {
                        if (string.IsNullOrEmpty(InviteUrl))
                        {
                            InviteUrl = GetInviteUrlFromString(Message.RawMessageBody);
                            break;
                        }
                        else
                        {
                            break;
                        }
                    }
                }
            }
            else
            {
                IsLogin = false;
            }

            return(InviteUrl);
        }
Пример #2
0
        public static HostDetails GetHostDetails(string Domain)
        {
            HostDetails HD = new HostDetails();

            switch (Domain)
            {
            case "yahoo.com":
                HD.Host = "pop.mail.yahoo.com";
                HD.Port = 995;
                break;

            case "gmail.com":
                HD.Host = "pop.gmail.com";
                HD.Port = 995;
                break;

            default:
                HD.Host = "rsb16.rhostbh.com";
                HD.Port = 995;
                break;
            }

            return(HD);
        }