C # verify the code of the regular expression of the message

xiaoxiao2021-03-06  16

Verify the correctness of the input

Public Static Bool ISEMAIL (String INPUTEMAIL) {INPUTEMAIL = Nulltostring (Inputemail); String Strregex = @ "^ ([A-ZA-Z0-9 _ / - /.] ) @ ((/ [[0-9] {1 , 3} /. [0-9] {1, 3} /. [0-9] {1,3} /.) | (([A-ZA-Z0-9 /-] ) ([A-ZA-Z] {2, 4} | [0-9] {1,3}) (/]?) $ "; regex re = new regex (strregex); if (Re.ismatch (INPUTEMAIL) )) Return (TRUE); elsereturn (false);}

Verify the correctness of the email address:

String [] Host = (Address.Split (@)); string hostname = host [1];

IPHostEntry IPhst = Dns.Resolve (hostname); IPEndPoint endPt = new IPEndPoint (IPhst.AddressList [0], 25); Socket s = new Socket (endPt.AddressFamily, SocketType.Stream, ProtocolType.Tcp); s.Connect (endPt );

// attempting to connectif (! Check_Response.connect_success) {s.close (); return false;}

// Helo Serversenddata (S, String.Format ("Helo {0} / r / n", 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: {0} / r / n", "TESTEXAMPLE@deepak.portland.co ")); 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;} Return (TRUE);

转载请注明原文地址:https://www.9cbs.com/read-61524.html

New Post(0)