驗證輸入的正確性
public static bool isEmail( string inputEmail )
{
inputEmail = NulltoString( inputEmail );
string strRegex = @
Regex re = new Regex( strRegex );
if ( re
return ( true );
else
return ( false );
}
驗證郵件地址的正確性
string[] host = ( address
string hostname = host[
IPHostEntry IPhst = Dns
IPEndPoint endPt = new IPEndPoint( IPhst
Socket s= new Socket( endPt
s
//Attempting to connect
if( !Check_Response( s
{
s
return false;
}
//HELO server
Senddata( s
if( !Check_Response( s
{
s
return false;
}
//Identify yourself
//Servers may resolve your domain and check whether you are listed in BlackLists etc
Senddata( s
if( !Check_Response( s
{
s
return false;
}
//Attempt Delivery ( I can use VRFY
Senddata( s
if( !Check_Response( s
{
s
return false;
}
return ( true );
From:http://tw.wingwit.com/Article/program/net/201311/12817.html