II.B. 语法(续)
2. 消息的通用语法
注意:该语法表明 <required-headers> 中的项目必须按特定顺序排列,并位于所有其他头部项目之前。事实上,头部字段并不要求按任何特定顺序出现。必需的头部项目必须唯一(恰好出现一次)。本规范允许大多数可选字段多次出现,但此处并未规定对这种多次出现的解释。
<message> ::= <headers>
| <headers> <crlf> <message-text>
<headers> ::= <required-headers>
| <required-headers> <optional-headers>
<required-headers> ::= <date-field> <originator>
<originator> ::= <mach-from-field>
| <mach-from-list> <sender-field>
| <mach-from-field> <reply-to-field>
| <any-from-field> <sender-field>
<reply-to-field>
<date-field> ::= "Date" ":" <date-time>
<mach-from-field> ::= "From" ":" <mach-addr-item>
<mach-from-list> ::= "From" ":" <mach-addr-list>
<any-from-field> ::= "From" ":" <address-list>
<sender-field> ::= "Sender" ":" <host-phrase>
<reply-to-field> ::= "Reply-To" ":" <mach-addr-list>
<optional-headers>::= <optional-header-field>
| <optional-headers>
<optional-header-field>
<optional-header-field> ::= <addressee-field>
| <extension-field>
<addressee-field> ::= "To" ":" <address-list>
| "cc" ":" <address-list>
| "bcc" ":" <address-list>
| "Fcc" ":" <path-list>
<extension-field> ::= "In-Reply-To" ":" <reference-list>
| "Keywords" ":" <phrase-list>
| "Message-Id" ":" <mach-host-phrase>
| "References" ":" <reference-list>
| "Subject" ":" <text-line>
| "Comments" ":" <text-line>
| <user-defined-field>
<user-defined-field> ::= <A <field> which has a <field-name>
not defined in this specification>
以下各字段体的语法,应被理解为把每个字段体描述为单个长字符串(或长行)。词法分析一节(II.B.1 节)已说明这样的长字符串如何在实际传输的消息中以多行表示。
3. 通用收件项的语法
<mach-addr-list> ::= <mach-addr-item>
| <mach-addr-item> "," <address-list>
<address-list> ::= <null>
| <address-item>
| <address-item> "," <address-list>
<address-item> ::= <mach-addr-item>
| <group-name> ":" <address-list> ";"
| <any-name>
| <path>
<mach-addr-item> ::= <mailbox>
| <phrase> "<" <mailbox-list> ">"
<group-name> ::= <phrase>
<any-name> ::= <quoted-string>
<mailbox-list> ::= <mailbox>
| <mailbox> "," <mailbox-list>
<mailbox> ::= <host-phrase>
<path> ::= ":" "File" ":" <path-name>
<path-name> ::= <path-item>
| "<" <path-list> ">"
<path-list> ::= <path-item>
| <path-item> "," <path-list>
<path-item> ::= <host-phrase>
4. 辅助语法
<reference-list> ::= <null>
| <reference-item>
| <reference-item> "," <reference-list>
<reference-item> ::= <phrase>
| <mach-host-phrase>
<mach-host-phrase>::= "<" <host-phrase> ">"
<host-phrase> ::= <phrase> <host-indicator>
<host-indicator> ::= <at-indicator> <host-name>
<at-indicator> ::= "at" | "@"
<host-name> ::= <atom>
| <decimal host address>
<date-time> ::= <day> <date> <time>
<day> ::= <null>
| <day-of-week> ","
<day-of-week> ::= "Monday" | "Mon"
| "Tuesday" | "Tue"
| "Wednesday" | "Wed"
| "Thursday" | "Thu"
| "Friday" | "Fri"
| "Saturday" | "Sat"
| "Sunday" | "Sun"
<date> ::= <string-date>
| <slash-date>
<string-date> ::= <day-of-month> <string-month>
<4-digit-year>
<slash-date> ::= <numeric-month> "/" <date-of-month>
"/" <2-digit-year>
<numeric-month> ::= <one or two decimal digits>
<day-of-month> ::= <one or two decimal digits>
<string-month> ::= "January" | "Jan"
| "February" | "Feb"
| "March" | "Mar"
| "April" | "Apr"
| "May"
| "June" | "Jun"
| "July" | "Jul"
| "August" | "Aug"
| "September"| "Sep"
| "October" | "Oct"
| "November" | "Nov"
| "December" | "Dec"
<4-digit-year> ::= <four decimal digits>
<2-digit-year> ::= <two decimal digits>
<time> ::= <24-hour-time> "-" <time-zone>
<24-hour-time> ::= <hour> <minute>
<hour> ::= <two decimal digits>
<minute> ::= <two decimal digits>
<time-zone> ::= "GMT" | "Z" | "GDT"
| "AST" | "ADT"
| "EST" | "EDT" | "CST" | "CDT"
| "MST" | "MDT" | "PST" | "PDT"
| "YST" | "YDT" | "HST" | "HDT"
<phrase> ::= <word>
| <word> <phrase>
<phrase-list> ::= <null>
| <phrase>
| <phrase> "," <phrase-list>
<word> ::= <atom>
| <quoted-string>