Exemple #1
0
        bool login()
        {
            string res = "";
            net = new NetService(account.Pop3add, account.Pop3port);
            while ("" == (res = net.getmsg())) ;
            if (res[0] != '+')
            {
                setInfo(errs[0]);
                return false;
            }

            if (step("USER " + account.Username + Mail.crlf, errs[1])[0] != '+')
                return false;

            if (step("PASS " + account.Password + Mail.crlf, errs[2])[0] != '+')
                return false;

            return true;
        }
        bool login()
        {
            string res = "";

            net = new NetService(account.Smtpadd, account.Smtpport);
            while ("" == (res = net.getmsg()))
            {
                ;
            }
            string[] strs = res.Split(new char[] { ' ', '-' });
            if (strs[0] != codes[0])
            {
                setInfo(res);
                return(false);
            }

            if (!step("EHLO " + account.Smtpadd + Mail.crlf, codes[1]))
            {
                return(false);
            }

            if (!step("AUTH LOGIN" + Mail.crlf, codes[2]))
            {
                return(false);
            }

            string u64 = Convert.ToBase64String(Encoding.UTF8.GetBytes(account.Username));

            if (!step(u64 + Mail.crlf, codes[2]))
            {
                return(false);
            }

            string p64 = Convert.ToBase64String(Encoding.UTF8.GetBytes(account.Password));

            if (!step(p64 + Mail.crlf, codes[3]))
            {
                return(false);
            }

            return(true);
        }