//正则表达式验证邮箱格式 Regex regex = new Regex(@"^\w+([-+.]\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*$"); //实例化电子邮件类 //添加收件人 string[] Receive = Receivelist.Split(';'); if (Receive.Length > 0) { for (int i = 0; i < Receive.Length; i++) { //验证邮箱是否为空,以及其格式是否正确 if (Receive[i] != "") { if (regex.IsMatch(Receive[i])) { mmsg.To.Add(Receive[i]); } } } }
标签:regex,Regex,验证,正则表达式,邮箱地址,Receive From: https://www.cnblogs.com/yuanshuo/p/17393405.html