Example #1
0
        private void TextBoxFrom_TextChanged(object sender, EventArgs e)
        {
            MailAddress address = new MailAddress(TextBoxFrom.Text);

            if (_autoChangeUser)
            {
                TextBoxUser.Text = address.Address;
            }

            if (_autoChangeServer)
            {
                string domain = address.GetAddressDomain();
                if (string.Compare(domain, "hotmail.com", true) == 0)
                {
                    TextBoxServer.Text = "smtp.live.com";
                }
                else if (string.Compare(domain, "gmail.com", true) == 0)
                {
                    TextBoxServer.Text = "smtp.gmail.com";
                }
                else if (string.Compare(domain, "yahoo.com", true) == 0)
                {
                    TextBoxServer.Text = "smtp.mail.yahoo.com";
                }
                else if (string.Compare(domain, "aol.com", true) == 0)
                {
                    TextBoxServer.Text = "smtp.aol.com";
                }

                ChangeSettingforWellKnownServer(TextBoxServer.Text);
            }
        }
        // change server address by well known email domain
        private void TextFrom_TextChanged(object sender, TextChangedEventArgs e)
        {
            var    address = new MailAddress(TextFrom.Text);
            string domain  = address.GetAddressDomain();

            if (_autoChangeUser)
            {
                TextUser.Text = address.Address;
            }

            if (_autoChangeServer)
            {
                if (string.Compare(domain, "hotmail.com", true) == 0)
                {
                    TextServer.Text = "smtp.live.com";
                }
                else if (string.Compare(domain, "gmail.com", true) == 0)
                {
                    TextServer.Text = "smtp.gmail.com";
                }
                else if (string.Compare(domain, "yahoo.com", true) == 0)
                {
                    TextServer.Text = "smtp.mail.yahoo.com";
                }
                else if (string.Compare(domain, "aol.com", true) == 0)
                {
                    TextServer.Text = "smtp.aol.com";
                }
            }
        }