Example #1
0
        public string AddEmailAddress(string addr)
        {
            string pattern = @"\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*"; // 定义正则表达式
            Match  m       = Regex.Match(addr, pattern);                     // 匹配正则表达式

            if (!m.Success)
            {
                return("邮箱地址格式有误!");
            }
            int affectedRow = emailAddressService.InsertEmailAddress(addr);

            if (affectedRow < 1)
            {
                return("添加邮箱失败!");
            }
            return("添加邮箱成功!");
        }