Re: Validating an email address

Discussion in 'Python' started by Jean-Paul Calderone, Dec 9, 2005.

  1. On Fri, 9 Dec 2005 11:10:04 +0000, Tom Anderson <> wrote:
    >Hi all,
    >
    >A hoary old chestnut this - any advice on how to syntactically validate an
    >email address? I'd like to support both the display-name-and-angle-bracket
    >and bare-address forms, and to allow everything that RFC 2822 allows (and
    >nothing more!).
    >
    >Currently, i've got some regexps which recognise a common subset of
    >possible addresses, but it would be nice to do this properly - i don't
    >currently support quoted pairs, quoted strings, or whitespace in various
    >places where it's allowed. Adding support for those things using regexps
    >is really hard. See:
    >
    >http://www.ex-parrot.com/~pdw/Mail-RFC822-Address.html
    >
    >For a level to which i am not prepared to stoop.
    >
    >I hear the email-sig are open to adding a validation function to the email
    >package, if a satisfactory one can be written; i would definitely support
    >their doing that.


    The top part of <http://divmod.org/users/viewcvs.twistd/branches/exarkun/smtp-2418/quotient/proto/smtp.py?rev=7661&view=markup> contains a parser that, IIRC, is basically complete. There are unit tests nearby, too. The code is MIT licensed.

    Jean-Paul
     
    Jean-Paul Calderone, Dec 9, 2005
    #1
    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. Replies:
    2
    Views:
    5,914
  2. cemcat
    Replies:
    1
    Views:
    9,126
    Siva M
    Dec 19, 2005
  3. Tom Anderson

    Validating an email address

    Tom Anderson, Dec 9, 2005, in forum: Python
    Replies:
    3
    Views:
    389
    Mike Meyer
    Dec 10, 2005
  4. Zeynel
    Replies:
    1
    Views:
    564
    alex23
    Dec 6, 2010
  5. Replies:
    5
    Views:
    259
    Dr John Stockton
    Dec 23, 2005
Loading...

Share This Page