Ejemplo n.º 1
0
 string step(string cmd, string err)
 {
     string res = "";
     while (!net.send(cmd)) ;
     while ("" == (res = net.getmsg())) ;
     if (res[0] != '+')
         setInfo(err);
     return res;
 }
Ejemplo n.º 2
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;
        }
Ejemplo n.º 3
0
        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);
        }
Ejemplo n.º 4
0
        bool step(string cmd, string statuscode)
        {
            string res = "";

            while (!net.send(cmd))
            {
                ;
            }
            while ("" == (res = net.getmsg()))
            {
                ;
            }
            string[] strs = res.Split(new char[] { ' ', '-' });
            if (strs[0] != statuscode)
            {
                setInfo(res);
                return(false);
            }
            return(true);
        }