تابع بررسی صحت ایمیل
پنجشنبه, ۱۲ شهریور ۱۳۹۴، ۰۲:۰۲ ب.ظ
برای اعتبار سنجی ایمیل می توان از متد زیر استفاده کرد :
|
using System.Text.RegularExpressions;
------------------------ public bool TestEmailRegex( string emailAddress)
{ string patternStrict = @"^(([^<>()[\]\\.,;:\s@\""]+"
+ @"(\.[^<>()[\]\\.,;:\s@\""]+)*)|(\"".+\""))@"
+ @"((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}"
+ @"\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+"
+ @"[a-zA-Z]{2,}))$" ;
Regex reStrict = new Regex(patternStrict);
bool isStrictMatch = reStrict.IsMatch(emailAddress);
return isStrictMatch;
} |
۹۴/۰۶/۱۲