public ConfigureSMTPForm(string hostname, int port, SMTPAuthenticationType authType, string username, string password, bool tls, MailMessage msg) { InitializeComponent(); portTextBox.KeyPress += new KeyPressEventHandler(portTextBox_KeyPress); hostTextBox.Text = hostname; portTextBox.Text = port < 1 ? 25.ToString() : port.ToString(); tlsCheckBox.Checked = tls; this.msg = msg; switch (authType) { case SMTPAuthenticationType.None: authNoneRadioButton.Checked = true; break; case SMTPAuthenticationType.Machine: authMachineRadioButton.Checked = true; break; case SMTPAuthenticationType.UsernamePassword: authUsernameRadioButton.Checked = true; break; default: authNoneRadioButton.Checked = true; break; } usernameTextBox.Text = username; passwordTextBox.Text = password; }