Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Sep 2005
    Posts
    8
    Thanks
    0
    Thanked 0 Times in 0 Posts

    check email existance

    can anybody help me validate email address by check a passed email address is a ‘real/existance’ address or not?

    for example
    boa@yahoo.com
    abc@gmail.com
    xhju@jhjfd.com

    thank in advance

  • #2
    New Coder
    Join Date
    Aug 2006
    Posts
    11
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You can go anywhere from very simple to very complex in checking whether the syntax of an email address is correct. The most simple solution would be:
    Code:
    function isValidEmail(str) {
       return (str.indexOf(".") > 2) && (str.indexOf("@") > 0); 
    }
    But is is hardly bulletproof. Better would be using a Regex to validate email syntax, i.e
    Code:
    function checkMail(emailInput) {
      var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z0-9]{2,4})+$/;
      if (filter.test(x)) alert('YES! Correct email address');
      else alert('NO! Incorrect email address');
    }
    Check Google for "javascript email validation". Checking whether an email address also actually exists is much harder, and you need PHP (or any other serverside language) and a configurable mailserver for that.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •