コード例 #1
0
ファイル: MailClient.cs プロジェクト: ComputerSimp/MailClient
        private void configurationButton_Click(object sender, EventArgs e)
        {
            ConfigurationForm confForm = new ConfigurationForm();

            if (confForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                //Incomming Server info
                inServer = confForm.getInServer();
                inUser = confForm.getInUser();
                inPass = confForm.getInPass();
                inSSL = confForm.getInSSL();
                inPort = int.Parse(confForm.getInPort());

                //Outgoing Server Info
                outServer = confForm.getOutServer();
                outUser = confForm.getOutUser();
                outPass = confForm.getOutPass();
                outSSL = confForm.getInSSL();
                outPort = int.Parse(confForm.getOutPort());

                smtpClient.Host = outServer;
                smtpClient.Port = outPort;
                smtpClient.Credentials = new System.Net.NetworkCredential(outUser, outPass);
                smtpClient.EnableSsl = outSSL;

                //Receive mail, & new Thread

                if (!bwUpdater.IsBusy)
                {
                    bwUpdater.RunWorkerAsync();
                }
            }
        }
コード例 #2
0
ファイル: MainForm.cs プロジェクト: ComputerKim/MailClient
        private void configurationButton_Click(object sender, EventArgs e)
        {
            ConfigurationForm confForm = new ConfigurationForm();

            if (confForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
            {
                // Get incoming server settings
                inServer = confForm.getInServer();
                inUser = confForm.getInUser();
                inPass = confForm.getInPass();
                inPort = int.Parse(confForm.getInPort());
                inSSL = confForm.getInSSL();

                // Get outgoing server settings
                outServer = confForm.getOutServer();
                outUser = confForm.getOutUser();
                outPass = confForm.getOutPass();
                outPort = int.Parse(confForm.getOutPort());
                outSSL = confForm.getOutSSL();

                // Create smtp client
                smtpClient.Host = outServer;
                smtpClient.Port = outPort;
                smtpClient.Credentials = new System.Net.NetworkCredential(outUser, outPass);
                smtpClient.EnableSsl = outSSL;

                // Receive mails
                backgroundUpdater.RunWorkerAsync();
            }
        }