html注册验证正则表达式 C#验证邮件的正则表达式的代码
C#验证邮件的正则表达式的代码
验证输入的正确性
public static bool isEmail( string inputEmail )
{
inputEmail = NulltoString( inputEmail );
string strRegex = @ ^( [a zA Z _ ]+ )@( ( [[ ]{ } [ ]{ } [ ]{ } )|( ( [a zA Z ]+ )+ ) )( [a zA Z]{ }|[ ]{ } )( ]? )$ ;
Regex re = new Regex( strRegex );
if ( re IsMatch( inputEmail ) )
return ( true );
else
return ( false );
}
验证邮件地址的正确性
string[] host = ( address Split( @ ) );
string hostname = host[ ];
IPHostEntry IPhst = Dns Resolve( hostname );
IPEndPoint endPt = new IPEndPoint( IPhst AddressList[ ] );
Socket s= new Socket( endPt AddressFamily SocketType Stream ProtocolType Tcp );
s Connect( endPt );
//Attempting to connect
if( !Check_Response( s SMTPResponse CONNECT_SUCCESS ) )
{
s Close( );
return false;
}
//HELO server
Senddata( s string Format( HELO { }rn Dns GetHostName( )) );
if( !Check_Response( s SMTPResponse GENERIC_SUCCESS ) )
{
s Close( );
return false;
}
//Identify yourself
//Servers may resolve your domain and check whether you are listed in BlackLists etc
Senddata( s string Format( MAIL From: { }rn testexample uk ) );
if( !Check_Response( s SMTPResponse GENERIC_SUCCESS ) )
{
s Close( );
return false;

}
//Attempt Delivery ( I can use VRFY but most SMTP servers only disable it for security reasons )
Senddata( s address );
if( !Check_Response( s SMTPResponse GENERIC_SUCCESS ) )
{
s Close( );
return false;
}
lishixinzhi/Article/program/net/201311/12817相关文章
- 正则表达式使用实例 在Javascript中test()的正则表达式前有两个波浪号是什么意思?
- 正则表达式使用实例 C#使用正则表达式去除html标记
- 正则表达式使用实例 ASP.NET使用正则表达式屏蔽垃圾信息
- 正则表达式使用实例 PHP网络编程:PHP处理正则表达式[2]
- 正则表达式使用实例 PHP和正则表达式
- 正则表达式使用实例 正则表达式的基本语法
- 正则表达式使用实例 正则表达式编程Regex类用法
- html注册验证正则表达式 C#验证邮件的正则表达式的代码
- 斩妖除魔!“联合利剑-2024B”有何不同之处?
- “联合利剑-2024B”枕戈待旦 解放军“围台”军演 强力震慑分裂势力 “务实战争引爆者”正在把台湾带入更深险境
爱学记

微信收款码
支付宝收款码