Click here to Skip to main content
16,021,041 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hell all

i am sending a mail for this i am entering text in multipletextbox . how to find whether any
email address or mobilenumber is exists in multilinetextbox or not. on click event of sendmail button. please tell me any one.

Thanks
Posted

1 solution

You can't check if an email address exists (in the sense that any message sent to it can be read) in any way other than to send a message to it and see if you get a reply.
You can however check if there is a valid email address in the textbox:
C#
public static Regex regex = new Regex(
      "([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})",
    RegexOptions.IgnoreCase
    | RegexOptions.CultureInvariant
    | RegexOptions.IgnorePatternWhitespace
    | RegexOptions.Compiled
    );


C#
Match m = regex.Match(myTextBox.Text);
if (m.Success)
   {
   // OK
   }
 
Share this answer
 
Comments
Joezer BH 11-Feb-13 9:33am    
5+
Maciej Los 11-Feb-13 10:05am    
+5!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900