ABNF for Internet Message Format -- RFC 2822
|
|
RFC2822 specifies a syntax for text messages that are sent
between computer users, within the framework of "electronic mail"
messages. The following ABNF grammar refers to obsolete syntactic elements
(starting with "obs-") that must be interpreted by implementations but
not generated. However, the obsolete syntax itself is not included in this page.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| NO-WS-CTL | = |
%d1-8 / %d11 / %d12 / %d14-31 / %d127
; Non white space controls:
; US-ASCII control characters that do not include the
; carriage return, line feed, and white space characters
|
| text | = |
%d1-9 / %d11 / %d12 / %d14-127 /
obs-text
; Characters excluding CR and LF
|
| specials | = |
"("
/ ")"
/ "<"
/ ">"
/ "["
/ "]"
/ ":"
/ ";"
/ "@"
/ "\"
/ ","
/ "." / DQUOTE
; Special characters used in other parts of the syntax
|
|
|
|
|
|
|
|
| quoted-pair | = |
("\"
text)
/ obs-qp
|
|
|
|
|
|
|
|
| FWS | = |
([*WSP CRLF] 1*WSP) /
obs-FWS
; Folding white space
|
| ctext | = |
NO-WS-CTL
/ %d33-39 / %d42-91 / %d93-126
; Non white space controls
; and the rest of the US-ASCII characters
; not including "(", ")", or "\"
|
| ccontent | = |
ctext
/ quoted-pair
/ comment
|
| comment | = |
"("
*([FWS]
ccontent)
[FWS]
")"
|
| CFWS | = |
*([FWS]
comment)
(([FWS]
comment)
/ FWS)
|
|
|
|
|
|
|
|
| atext | = |
ALPHA / DIGIT / "!"
/ "#"
/ "$"
/ "%"
/ "&"
/ "'"
/ "*"
/ "+"
/ "-"
/ "/"
/ "="
/ "?"
/ "^"
/ "_"
/ "`"
/ "{"
/ "|"
/ "}"
/ "~"
; Any character except controls, SP, and specials.
; Used for atoms
|
| atom | = |
[CFWS]
1*atext
[CFWS]
|
| dot-atom | = |
[CFWS]
dot-atom-text
[CFWS]
|
| dot-atom-text | = |
1*atext
*("."
1*atext)
|
|
|
|
|
|
|
|
| qtext | = |
NO-WS-CTL
/ %d33 / %d35-91 / %d93-126
; Non white space controls
; and the rest of the US-ASCII characters
; not including "\" or the quote character
|
| qcontent | = |
qtext
/ quoted-pair
|
| quoted-string | = |
[CFWS]
DQUOTE *([FWS]
qcontent)
[FWS] DQUOTE
[CFWS]
|
|
|
|
|
|
|
|
| word | = |
atom
/ quoted-string
|
| phrase | = |
1*word
/ obs-phrase
|
| utext | = |
NO-WS-CTL
/ %d33-126 / obs-utext
; Non white space controls
; and the rest of the US-ASCII characters
|
| unstructured | = |
*([FWS]
utext)
[FWS]
|
|
|
|
|
|
| date-time | = |
[ day-of-week
"," ]
date FWS
time [CFWS]
|
| day-of-week | = |
([FWS] day-name)
/ obs-day-of-week
|
| day-name | = |
"Mon"
/ "Tue"
/ "Wed"
/ "Thu"
/ "Fri"
/ "Sat"
/ "Sun"
|
| date | = |
day month year
|
| year | = |
4*DIGIT / obs-year
|
| month | = |
(FWS month-name FWS)
/ obs-month
|
| month-name | = |
"Jan"
/ "Feb"
/ "Mar"
/ "Apr"
/ "May"
/ "Jun"
/ "Jul"
/ "Aug"
/ "Sep"
/ "Oct"
/ "Nov"
/ "Dec"
|
| day | = |
([FWS] 1*2DIGIT)
/ obs-day
|
| time | = |
time-of-day FWS
zone
|
| time-of-day | = |
hour
":"
minute
[ ":"
second ]
|
| minute | = |
2DIGIT / obs-minute
|
| second | = |
2DIGIT / obs-second
|
| hour | = |
2DIGIT / obs-hour
|
| zone | = |
(( "+"
/ "-" ) 4DIGIT) /
obs-zone
|
|
|
|
|
|
| address | = |
mailbox
/ group
|
| mailbox | = |
name-addr
/ addr-spec
|
| name-addr | = |
[display-name]
angle-addr
|
| angle-addr | = |
[CFWS] "<"
addr-spec
">" [CFWS]
/ obs-angle-addr
|
| group | = |
display-name
":"
[mailbox-list / CFWS]
";" [CFWS]
|
| display-name | = |
phrase
|
| mailbox-list | = |
(mailbox
*(","
mailbox))
/ obs-mbox-list
|
| address-list | = |
(address
*(","
address))
/ obs-addr-list
|
| addr-spec | = |
local-part
"@"
domain
|
| local-part | = |
dot-atom / quoted-string
/ obs-local-part
|
| domain | = |
dot-atom / domain-literal
/ obs-domain
|
| domain-literal | = |
[CFWS] "["
*([FWS] dcontent) [FWS]
"]" [CFWS]
|
| dcontent | = |
dtext / quoted-pair
|
| dtext | = |
NO-WS-CTL / %d33-90 / %d94-126
; Non white space controls
; and the rest of the US-ASCII characters
; not including "[", "]", or "\"
|
|
|
|
|
|
| message | = |
(fields
/ obs-fields)
[CRLF body]
|
| body | = |
*(*998text CRLF) *998text
|
|
|
|
|
|
|
|
|
| fields | = |
*(trace
*(resent-date
/ resent-from
/ resent-sender
/ resent-to
/ resent-cc
/ resent-bcc
/ resent-msg-id))
*(orig-date
/ from
/ sender
/ reply-to
/ to
/ cc
/ bcc
/ message-id
/ in-reply-to
/ references
/ subject
/ comments
/ keywords
/ optional-field)
|
|
|
|
|
|
|
|
| orig-date | = |
"Date:"
date-time CRLF
|
|
|
|
|
|
|
|
| from | = |
"From:"
mailbox-list CRLF
|
| sender | = |
"Sender:"
mailbox CRLF
|
| reply-to | = |
"Reply-To:"
address-list CRLF
|
|
|
|
|
|
|
|
| to | = |
"To:"
address-list CRLF
|
| cc | = |
"Cc:"
address-list CRLF
|
| bcc | = |
"Bcc:"
(address-list / [CFWS]) CRLF
|
|
|
|
|
|
|
|
| message-id | = |
"Message-ID:"
msg-id CRLF
|
| in-reply-to | = |
"In-Reply-To:"
1*msg-id CRLF
|
| references | = |
"References:"
1*msg-id CRLF
|
| msg-id | = |
[CFWS] "<"
id-left
"@"
id-right
">" [CFWS]
|
| id-left | = |
dot-atom-text / no-fold-quote
/ obs-id-left
|
| id-right | = |
dot-atom-text / no-fold-literal
/ obs-id-right
|
| no-fold-quote | = |
DQUOTE *(qtext / quoted-pair) DQUOTE
|
| no-fold-literal | = |
"[" *(dtext / quoted-pair)
"]"
|
|
|
|
|
|
|
|
| subject | = |
"Subject:" unstructured CRLF
|
| comments | = |
"Comments:" unstructured CRLF
|
| keywords | = |
"Keywords:" phrase *(
"," phrase) CRLF
|
|
|
|
|
|
|
|
| resent-date | = |
"Resent-Date:"
date-time CRLF
|
| resent-from | = |
"Resent-From:"
mailbox-list CRLF
|
| resent-sender | = |
"Resent-Sender:"
mailbox CRLF
|
| resent-to | = |
"Resent-To:"
address-list CRLF
|
| resent-cc | = |
"Resent-Cc:"
address-list CRLF
|
| resent-bcc | = |
"Resent-Bcc:"
(address-list / [CFWS]) CRLF
|
| resent-msg-id | = |
"Resent-Message-ID:"
msg-id CRLF
|
|
|
|
|
|
|
|
| trace | = |
[return]
1*received
|
| return | = |
"Return-Path:"
path CRLF
|
| path | = |
([CFWS] "<"
([CFWS] / addr-spec)
">" [CFWS])
/ obs-path
|
| received | = |
"Received:"
name-val-list CRLF
";"
date-time CRLF
|
| name-val-list | = |
[CFWS] [name-val-pair
*(CFWS name-val-pair)]
|
| name-val-pair | = |
item-name
CFWS item-value
|
| item-name | = |
ALPHA *(["-"] (ALPHA / DIGIT))
|
| item-value | = |
1*angle-addr
/ addr-spec / atom
/ domain
/ msg-id
|
|
|
|
|
|
|
|
| optional-field | = |
field-name
":" unstructured CRLF
|
| field-name | = |
1*ftext
|
| ftext | = |
%d33-57 / %d59-126
; Any character except controls, SP, and ":"
|
|
|
|