コード例 #1
0
ファイル: Facade.cs プロジェクト: JBTech/MailSystem.NET
    public Facade()
	{
        this._accSettings = AccountSettings.Load(Constants.ACCOUNT_FILE_NAME_SETTINGS);
        this.popController = new Pop3Controller();
        this._imapController = new ImapController();
        this.smtpController = new SmtpController();
        this._changeImcoming = false;
    }
コード例 #2
0
ファイル: SmtpTests.cs プロジェクト: netusers2014/mixerp
 public static SmtpController Fixture()
 {
     SmtpController controller = new SmtpController(new SmtpRepository(), "", new LoginView());
     return controller;
 }
コード例 #3
0
ファイル: AddAccountForm.cs プロジェクト: mlnlover11/XMail
        /// <summary>
        /// Method for try to connect
        /// </summary>
        /// <returns>The string return.</returns>
        public string TryConnect()
        {
            this.progressBar.Visible = true;
            this.progressBar.Maximum = 10;
            this.progressBar.Value = 0;
            
            this.btnNext.Enabled = false;
            
            this.labelStatus.Text = "Verifying email configuration...";
            
            bool success = true;
            string msg = "You have just successfully completed adding a new account." +
                Environment.NewLine + "Please select finish to save the changes or cancel to discard them.";

            // verify incoming server email configurations.

            try
            {
                if (this._accInfo.MailAccountType == AccountType.POP3)
                {
                    Pop3Controller pop3Controller = new Pop3Controller(this._accInfo);
                    pop3Controller.Disconnect();
                }
                else if (this._accInfo.MailAccountType == AccountType.IMAP)
                {
                    Imap4Controller imap4Controller = new Imap4Controller(this._accInfo);
                    imap4Controller.Disconnect();
                }
            }
            catch (Exception)
            {
                success = false;
                msg = "The incoming server email configuration is not valid.\nPlease make sure that you have a stable internet connection,\nand have entered the correct username and password.";
            }

            // verify outcoming server email configurations.

            if (success)
            {
                this.labelStatus.Text = "Sending test email...";

                try
                {
                    SmtpController smtpController = new SmtpController();
                    ActiveUp.Net.Mail.Message message = smtpController.SendMessage(this._accInfo,
                                                                                   this._accInfo.EmailAddress, "XMail", "Test XMail email. If you can read this, XMail was set up correctly!", new string[0]);
                }
                catch (Exception)
                {
                    success = false;
                    msg = "The outgoing server email configuration is not valid.\nPlease make sure that you have a stable internet connection,\nand have entered the correct information.";
                }
            }
            
            
            if (success)
            {
                labelStatus.Text = msg;
                this.btnNext.Enabled = true;
                btnBack.Enabled = false;
                btnNext.Text = "Finish";
                _close = true;
                btnNext.Click -= btnNext_Click;
                btnNext.Click += delegate { this.Close(); };
            }
            else
            {
                this.labelStatus.Text = msg;
            }
            
            this.progressBar.Value = 10;
            this.progressBar.Visible = false;
            
            return string.Empty;
        }
コード例 #4
0
        public static SmtpController Fixture()
        {
            SmtpController controller = new SmtpController(new SmtpRepository(), "", new LoginView());

            return(controller);
        }