Пример #1
0
        public bool emailValidation(string email)
        {
            bool msg = false;

            try
            {
                string address = new MailAddress(email).Address;
                if (address.IndexOfAny(".".ToCharArray()) != -1)
                {
                    if (!address.Contains("..") || !address.Contains(".@") || !address.Contains("@.") || !address.Contains("._."))
                    {
                        if (!address.EndsWith("."))
                        {
                            msg = true;
                        }
                    }
                }
                else
                {
                    msg = false;
                }
            }
            catch (Exception ex)
            {
                msg = false;
            }

            return(msg);
        }