Are apostrophes valid in an email address?

Phil Pennock phil.pennock at globnix.org
Wed Feb 15 15:09:33 GMT 2006


On 2006-02-15 at 09:49 -0500, IvorW wrote:
> paddy.o'hagan at foobar.org

> Who's right?

The apostrophe is fine.

RFC 2821 and definitions of atext and qtext from RFC2822.

Without double-quotes, it needs to be atext, or a sequence of atext
joined by periods.  atext includes ... quite a few surprising
characters.  See below.

With double-quotes ... if you backslash-escape it, anything in 8-bit
ASCII with the top bit clear, except CR and NL and NUL.  Including an
empty string.  <""@example.tld> is valid, and some people use it to
bypass spam harvesters which can't cope with it.

-----------------------------< cut here >-------------------------------
my $RE_ATEXT    = qr/[A-Za-z0-9!#\$\%\&\'\*\+\/=\?\^_\`\{\|\}\~\-]/;
my $RE_QTEXT    = qr/[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]/;
my $EMAIL_LHS_REGEXP    = qr/
                             # Local-part
                             (?:
                              (?:
                                # Dot-string
                                (?:$RE_ATEXT)+ (?: \. $RE_ATEXT+)*
                              ) | (?:
                                # Quoted-string
                                \" (?: \s* (?:
                                 (?: $RE_QTEXT+ ) |
                                 (?: \\ [\x01-\x09\x0b\x0c\x0e-\x7f] )
                                ) )* \s* \"
                              )
                             )
                             /ox;
-----------------------------< cut here >-------------------------------
-- 
I am keeping international relations on a peaceable footing.
You are biding your time before acting.
He is coddling tyrants.
 -- Roger BW on topic of verb conjugation


More information about the london.pm mailing list