Posted By

housecor on 09/08/10


Tagged

email validation


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

Tyster


Assure a valid email that .Net can actually send an email to is passed.


 / Published in: C#
 

  1. protected void ValidEmail(object source, ServerValidateEventArgs args)
  2. {
  3. try
  4. {
  5. var a = new MailAddress(args.Value);
  6. }
  7. catch (Exception ex)
  8. {
  9. args.IsValid = false;
  10. return;
  11. }
  12. args.IsValid = true;
  13. }

Report this snippet  

You need to login to post a comment.