メインコンテンツまでスキップ

4. メッセージ仕様

4.1. 構文​

注: 表記規則の副作用により、この構文は、一部のフィールドが存在する場合には特定の順序でなければならないかのように示している。ヘッダーフィールドは、メッセージ本文がヘッダーの「後」に来なければならないことを除き、特定の順序で現れることを要求「されない」。ヘッダーが存在する場合には、"Return-Path"、"Received"、"Date"、"From"、"Subject"、"Sender"、"To"、"cc" などの順に送ることが推奨される。

本仕様は、ほとんどのフィールドが複数回現れることを許す。特記されている場合を除き、その解釈はここでは規定されず、その使用は推奨されない。

以下に示す各種フィールドの本体の構文は、各フィールド本体を単一の長い文字列 (または行) として記述しているものと考えるべきである。上の「メッセージの字句解析」の「長いヘッダーフィールド」の節は、そのような長い文字列が、実際に伝送されるメッセージでは複数行でどのように表せるかを示している。

message     =  fields *( CRLF *text )       ; Everything after
                                            ;  first null line
                                            ;  is message body

fields      =    dates                      ; Creation time,
                 source                     ;  author id & one
               1*destination                ;  address required
                *optional-field             ;  others optional

source      = [  trace ]                    ; net traversals
                 originator                 ; original mail
              [  resent ]                   ; forwarded

trace       =    return                     ; path to sender
               1*received                   ; receipt tags

return      =  "Return-path" ":" route-addr ; return address

received    =  "Received"    ":"            ; one per relay
                  ["from" domain]           ; sending host
                  ["by"   domain]           ; receiving host
                  ["via"  atom]             ; physical path
                 *("with" atom)             ; link/mail protocol
                  ["id"   msg-id]           ; receiver msg id
                  ["for"  addr-spec]        ; initial form
                   ";"    date-time         ; time received

originator  =   authentic                   ; authenticated addr
              [ "Reply-To"   ":" 1#address] )

authentic   =   "From"       ":"   mailbox  ; Single author
            / ( "Sender"     ":"   mailbox  ; Actual submittor
                "From"       ":" 1#mailbox) ; Multiple authors
                                            ;  or not sender

resent      =   resent-authentic
              [ "Resent-Reply-To"  ":" 1#address] )

resent-authentic =
            =   "Resent-From"      ":"   mailbox
            / ( "Resent-Sender"    ":"   mailbox
                "Resent-From"      ":" 1#mailbox  )

dates       =   orig-date                   ; Original
              [ resent-date ]               ; Forwarded

orig-date   =  "Date"        ":"   date-time

resent-date =  "Resent-Date" ":"   date-time

destination =  "To"          ":" 1#address  ; Primary
            /  "Resent-To"   ":" 1#address
            /  "cc"          ":" 1#address  ; Secondary
            /  "Resent-cc"   ":" 1#address
            /  "bcc"         ":"  #address  ; Blind carbon
            /  "Resent-bcc"  ":"  #address

optional-field =
            /  "Message-ID"        ":"   msg-id
            /  "Resent-Message-ID" ":"   msg-id
            /  "In-Reply-To"       ":"  *(phrase / msg-id)
            /  "References"        ":"  *(phrase / msg-id)
            /  "Keywords"          ":"  #phrase
            /  "Subject"           ":"  *text
            /  "Comments"          ":"  *text
            /  "Encrypted"         ":" 1#2word
            /  extension-field              ; To be defined
            /  user-defined-field           ; May be pre-empted

msg-id      =  "<" addr-spec ">"            ; Unique message id

extension-field =
              <Any field which is defined in a document
               published as a formal extension to this
               specification; none will have names beginning
               with the string "X-">

user-defined-field =
              <Any field which has not been defined
               in this specification or published as an
               extension to this specification; names for
               such fields must be unique and may be
               pre-empted by published extensions>