[BUG] Re: email syntax validation needed

Randal L. Schwartz merlyn at stonehenge.com
Mon Jun 16 05:09:02 UTC 2003


>>>>> "Lex" == Lex Spoon <lex at cc.gatech.edu> writes:

>> fred&barney at stonehenge.com (my example when it comes up - go ahead and test it!)

Lex> Are you certain that & may be used in an atom?  I followed the RFC
Lex> religiously, and I'm sure I started at <atom> and worked out the list of
Lex> allowed characters.  But maybe I misread it, or maybe a later RFC allows
Lex> more characters?

Following this in RFC2822:

addr-spec = local-part "@" domain

local-part = dot-atom / quoted-string / ...

dot-atom = dot-atom-text

dot-atom-text = 1*atext *("." 1*atext)

atext           =       ALPHA / DIGIT / ; Any character except controls,
                        "!" / "#" /     ;  SP, and specials.
                        "$" / "%" /     ;  Used for atoms
                        "&" / "'" /
                        "*" / "+" /
                        "-" / "/" /
                        "=" / "?" /
                        "^" / "_" /
                        "`" / "{" /
                        "|" / "}" /
                        "~"

Note the "&" in there.

So "fred&barney" is a valid local-part, consisting of a single dot-atom
which is a single dot-atom-text which is a string of one or more
atext.

See, nearly everything!

Even ?@stonehenge.com would be a legit address. :)

Special chars appear inside double-quoted strings:

quoted-string = DQUOTE *(qcontent) DQUOTE
qcontent = qtext / quoted-pair
qtext = (non-white-space controls and the rest of ASCII not including quote chars)
quoted-pair = ("\" text)
text = (any character excluding CR and LF)

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn at stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!



More information about the Squeak-dev mailing list