Closed Insomniak47 closed 3 years ago
Working on isolating/consolidating the BNF. There's so many things I didn't remember and can't believe are valid in an address :/
addr-spec = local-part "@" domain
local-part = dot-atom / quoted-string / obs-local-part
domain = dot-atom / domain-literal / obs-domain
dot-atom = [CFWS] dot-atom-text [CFWS]
quoted-string = [CFWS]
DQUOTE *([FWS] qcontent) [FWS] DQUOTE
[CFWS]
obs-local-part = word *("." word)
domain-literal = [CFWS] "[" *([FWS] dtext) [FWS] "]" [CFWS]
obs-domain = atom *("." atom)
CFWS = (1*([FWS] comment) [FWS]) / FWS
dot-atom-text = 1*atext *("." 1*atext)
DQUOTE = %x22
FWS = ([*WSP CRLF] 1*WSP) / obs-FWS
qcontent = qtext / quoted-pair
word = atom / quoted-string
dtext = %d33-90 / %d94-126 ; Printable US-ASCII characters
/ obs-dtext ; not including "[", "]", or "\"
atom = [CFWS] 1*atext [CFWS]
comment = "(" *([FWS] ccontent) [FWS] ")"
atext = ALPHA / DIGIT / "!" / "#" / "$" / "%" / "&" ; Printable US-ASCII characters
/ "'" / "*" / "+" / "-" / "/" / "=" / "?" ; not including specials.
/ "^" / "_" / "`" / "{" / "|" / "}" / "~"
WSP = SP / HTAB
CRLF = CR LF
obs-FWS = 1*WSP *(CRLF 1*WSP)
qtext = %d33 / %d35-91 ; Printable US-ASCII characters not
/ %d93-126 / obs-qtext ; including "\" or the quote character
quoted-pair = ("\" (VCHAR / WSP)) / obs-qp
obs-dtext = obs-NO-WS-CTL / quoted-pair
ccontent = ctext / quoted-pair / comment
ALPHA = %x41-5A / %x61-7A ; A-Z / a-z
DIGIT = %x30-39
SP = %x20
HTAB = %x09
CR = %x0D
LF = %x0A
VCHAR = %x21-7E
obs-qp = "\" (%d0 / obs-NO-WS-CTL / LF / CR)
obs-NO-WS-CTL = %d1-8 / ; US-ASCII control
%d11 / ; characters that do not
%d12 / ; include the carriage
%d14-31 / ; return, line feed, and
%d127 ; white space characters
ctext = %d33-39 / ; Printable US-ASCII
%d42-91 / ; characters not including
%d93-126 / ; "(", ")", or "\"
obs-ctext
obs-ctext = obs-NO-WS-CTL
C# Lacks a small, lightweight and immutable email address type built into the language and that's a pain. It would be awesome to have a solution that meets the spec completely with the following methods.
RFC Available in: https://tools.ietf.org/html/rfc5322#section-3.4.1