Exemple #1
0
        private void m_pConnect_Click(object sender, EventArgs e)
        {
            if (m_pUserName.Text == "")
            {
                MessageBox.Show(this, "Please fill user name !", "Error:", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            POP3_Client pop3 = new POP3_Client();

            try{
                pop3.Logger           = new Logger();
                pop3.Logger.WriteLog += m_pLogCallback;
                pop3.Connect(m_pServer.Text, (int)m_pPort.Value, (m_pSecurity.SelectedIndex == 2));
                if (m_pSecurity.SelectedIndex == 1)
                {
                    pop3.Stls(null);
                }
                pop3.Login(m_pUserName.Text, m_pPassword.Text);

                m_pPop3           = pop3;
                this.DialogResult = DialogResult.OK;
                this.Close();
            }
            catch (Exception x) {
                MessageBox.Show(this, "POP3 server returned: " + x.Message + " !", "Error:", MessageBoxButtons.OK, MessageBoxIcon.Error);
                pop3.Dispose();
            }
        }