email address validation

Discussion in 'Javascript' started by wizard04, Jun 26, 2007.

  1. wizard04

    wizard04 Guest

    I'm trying to validate an email address field before it is submitted.
    I have read RFC 822 (http://www.faqs.org/rfcs/rfc822.html) but I'm not
    sure I'm fully grasping it. As far as I understand, a convoluted
    email address like andy."har<ri>\"son"@example.com would be
    valid. Please correct me if I'm wrong.
    wizard04, Jun 26, 2007
    #1
    1. Advertising

  2. wizard04

    Darko Guest

    On Jun 26, 5:21 pm, wizard04 <> wrote:
    > I'm trying to validate an email address field before it is submitted.
    > I have read RFC 822 (http://www.faqs.org/rfcs/rfc822.html) but I'm not
    > sure I'm fully grasping it. As far as I understand, a convoluted
    > email address like andy."har<ri>\"son"@example.com would be
    > valid. Please correct me if I'm wrong.


    I think google search would give you a zillion links that give you
    complete scripts and examples.
    Darko, Jun 26, 2007
    #2
    1. Advertising

  3. "wizard04" <> wrote in message
    news:...
    > I'm trying to validate an email address field before it is submitted.
    > I have read RFC 822 (http://www.faqs.org/rfcs/rfc822.html) but I'm not
    > sure I'm fully grasping it. As far as I understand, a convoluted
    > email address like andy."har<ri>\"son"@example.com would be
    > valid. Please correct me if I'm wrong.
    >



    Well, you have a quoted string in there so its ok...

    basically you have andy."..."@example.com

    which is fine. Anything in a quoted string and it only looks odd because it
    isn't really used(actually I have no idea why its used). So as far as the
    lexer is concerned, thats all just one token inside the quotes and it
    doesn't get parsed any farther(except possibly for quoted pairs).

    In reality its not convoluted but just looks a bit strange(not sure how mail
    servers handle the quoted string though).

    Jon
    Jon Slaughter, Jun 26, 2007
    #3
  4. wizard04

    wizard04 Guest

    Thanks Jon :)

    On Jun 26, 12:22 pm, "Jon Slaughter" <>
    wrote:
    > Anything in a quoted string and it only looks odd because it
    > isn't really used(actually I have no idea why its used).


    I don't expect anyone to actually have an address like this; I'm just
    being a perfectionist. ;-)

    > (not sure how mail servers handle the quoted string though).


    Good question! My web host won't let me create an address with quotes,
    so that says something. Probably best not to allow special characters
    at all (except the .).
    wizard04, Jun 26, 2007
    #4
  5. "wizard04" <> wrote in message
    news:...
    > Thanks Jon :)
    >
    > On Jun 26, 12:22 pm, "Jon Slaughter" <>
    > wrote:
    >> Anything in a quoted string and it only looks odd because it
    >> isn't really used(actually I have no idea why its used).

    >
    > I don't expect anyone to actually have an address like this; I'm just
    > being a perfectionist. ;-)
    >
    >> (not sure how mail servers handle the quoted string though).

    >
    > Good question! My web host won't let me create an address with quotes,
    > so that says something. Probably best not to allow special characters
    > at all (except the .).
    >



    Yeah... you might also try some other rfc's just to be sure. The one you
    gave,

    RFC 822 - STANDARD FOR THE FORMAT OF ARPA INTERNET TEXT MESSAGES

    Might not be the standard for what is used for the mail protocol that we
    commonly use(which I guess is smtp or whatever).
    Jon Slaughter, Jun 26, 2007
    #5
  6. In comp.lang.javascript message <
    glegroups.com>, Tue, 26 Jun 2007 15:21:51, wizard04 <>
    posted:
    >I'm trying to validate an email address field before it is submitted.
    >I have read RFC 822 (http://www.faqs.org/rfcs/rfc822.html) but I'm not
    >sure I'm fully grasping it. As far as I understand, a convoluted
    >email address like andy."har<ri>\"son"@example.com would be
    >valid. Please correct me if I'm wrong.


    Since it is impossible to determine whether an actual address is correct
    - here, *0723 is currently valid, but soon it will not be - there's no
    point in rigorously checking the format (unless you are an issuer of new
    addresses).

    The only sensible tests are whether the field has been left empty, and
    whether the field might be an E-address. See
    <URL:http://www.merlyn.demon.co.uk/js-valid.htm#VEmA>.

    It's a good idea to write the newsgroup c.l.j and its FAQ. See below.

    --
    (c) John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v6.05 IE 6
    news:comp.lang.javascript FAQ <URL:http://www.jibbering.com/faq/index.html>.
    <URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
    <URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.
    Dr J R Stockton, Jun 27, 2007
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mark B
    Replies:
    3
    Views:
    2,110
    Mark B
    Jul 22, 2009
  2. Zeynel
    Replies:
    1
    Views:
    559
    alex23
    Dec 6, 2010
  3. David, the great

    Validation on email address

    David, the great, Jun 17, 2008, in forum: ASP General
    Replies:
    6
    Views:
    173
    Daniel Crichton
    Jun 18, 2008
  4. Vamsi Krishna

    regarding validation of email address.

    Vamsi Krishna, Jul 28, 2008, in forum: Ruby
    Replies:
    2
    Views:
    110
    Kyle Schmitt
    Jul 28, 2008
  5. Replies:
    5
    Views:
    257
    Dr John Stockton
    Dec 23, 2005
Loading...

Share This Page