Пример #1
0
        private void btnLogin_Click(object sender, System.EventArgs e)
        {
            if (imap41.Active)
            {
                MessageBox.Show("You are already connected. Please click Logout to disconnect.");
                return;
            }

            try
            {
                imap41.Server   = edtServer.Text;
                imap41.Port     = Convert.ToInt32(edtPort.Text);
                imap41.UserName = edtUser.Text;
                imap41.Password = edtPassword.Text;
                imap41.UseSasl  = cbUseSPA.Checked;
                imap41.TimeOut  = Convert.ToInt32(edtTimeOut.Text) * 1000;
                imap41.Open();

                GetFolderList();

                UpdateStatus();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Пример #2
0
        private void btnLogin_Click(object sender, System.EventArgs e)
        {
            if (imap.Active)
            {
                return;
            }

            oAuth.AuthUrl      = "https://accounts.google.com/o/oauth2/auth";
            oAuth.TokenUrl     = "https://accounts.google.com/o/oauth2/token";
            oAuth.RedirectUrl  = "http://localhost";
            oAuth.ClientID     = "421475025220-6khpgoldbdsi60fegvjdqk2bk4v19ss2.apps.googleusercontent.com";
            oAuth.ClientSecret = "_4HJyAVUmH_iVrPB8pOJXjR1";
            oAuth.Scope        = "https://mail.google.com/";

            imap.Server = "imap.gmail.com";
            imap.Port   = 993;
            imap.UseTls = ClientTlsMode.Implicit;

            imap.UserName = edtUser.Text;

            imap.Authorization = oAuth.GetAuthorization();

            imap.Open();

            FillFolderList();
        }
Пример #3
0
        private void btnLogin_Click(object sender, System.EventArgs e)
        {
            if (imap41.Active)
            {
                return;
            }

            certificateVerified = false;

            imap41.Server = edtServer.Text;
            imap41.Port   = Convert.ToInt32(edtPort.Text);
            imap41.UseTls = cbUseTLS.Checked ? ClientTlsMode.Automatic : ClientTlsMode.None;

            imap41.UserName = edtUser.Text;
            imap41.Password = edtPassword.Text;

            imap41.Open();

            FillFolderList();
        }