Posted By

jfherring on 01/04/09


Tagged

email php


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

will_00
rbatenb
joegilbert


Valid email address filter


 / Published in: PHP
 

I think this is php 5 only

  1. <?php
  2.  
  3. $emailAddress = "my_email_test@mail server.com";
  4.  
  5. if(!filter_var($emailAddress, FILTER_VALIDATE_EMAIL))
  6. {
  7. echo "Submitted address is faulty";
  8. }
  9. else
  10. {
  11. echo "Address submitted successfully";
  12. }
  13.  
  14. ?>

Report this snippet  

Comments

RSS Icon Subscribe to comments
Posted By: jonatanfroes on October 1, 2010

function validEmail($emailAddress) { return (bool) filtervar($emailAddress, FILTERVALIDATE_EMAIL); }

You need to login to post a comment.