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

4.1.2. コマンドの構文

コマンドは、コマンド・コードとそれに続く引数フィールドから成る。コマンド・コードは 4 文字の英字である。英字の大文字と小文字は同一に扱われる。したがって、次のいずれも mail コマンドを表し得る。

MAIL    Mail    mail    MaIl    mAIl

これは、順方向パスの "TO" や "to" のように、パラメーター値を表す記号にも当てはまる。コマンド・コードと引数フィールドは、一つ以上の空白で区切られる。ただし、逆方向パスと順方向パスの引数の内部では、大文字・小文字が重要である。特に、ホストによっては、ユーザー "smith" とユーザー "Smith" は別のユーザーである。

引数フィールドは、文字列 <CRLF> で終わる可変長の文字列から成る。受信側は、この文字列を受信するまで、何も処理を行ってはならない。

角括弧は、任意の引数フィールドを表す。オプションが選ばれなかった場合は、適切なデフォルト値が暗黙に指定されたものとみなす。

SMTP コマンドは次のとおりである。

HELO <SP> <domain> <CRLF>

MAIL <SP> FROM:<reverse-path> <CRLF>

RCPT <SP> TO:<forward-path> <CRLF>

DATA <CRLF>

RSET <CRLF>

SEND <SP> FROM:<reverse-path> <CRLF>

SOML <SP> FROM:<reverse-path> <CRLF>

SAML <SP> FROM:<reverse-path> <CRLF>

VRFY <SP> <string> <CRLF>

EXPN <SP> <string> <CRLF>

HELP [<SP> <string>] <CRLF>

NOOP <CRLF>

QUIT <CRLF>

TURN <CRLF>

上記の引数フィールドの構文を (該当する場合は BNF 記法を用いて) 以下に示す。"..." という記法は、フィールドが一回以上繰り返されてよいことを示す。

<reverse-path> ::= <path>

<forward-path> ::= <path>

<path> ::= "<" [ <a-d-l> ":" ] <mailbox> ">"

<a-d-l> ::= <at-domain> | <at-domain> "," <a-d-l>

<at-domain> ::= "@" <domain>

<domain> ::= <element> | <element> "." <domain>

<element> ::= <name> | "#" <number> | "[" <dotnum> "]"

<mailbox> ::= <local-part> "@" <domain>

<local-part> ::= <dot-string> | <quoted-string>

<name> ::= <a> <ldh-str> <let-dig>

<ldh-str> ::= <let-dig-hyp> | <let-dig-hyp> <ldh-str>

<let-dig> ::= <a> | <d>

<let-dig-hyp> ::= <a> | <d> | "-"

<dot-string> ::= <string> | <string> "." <dot-string>

<string> ::= <char> | <char> <string>

<quoted-string> ::= """ <qtext> """

<qtext> ::= "\" <x> | "\" <x> <qtext> | <q> | <q> <qtext>

<char> ::= <c> | "\" <x>

<dotnum> ::= <snum> "." <snum> "." <snum> "." <snum>

<number> ::= <d> | <d> <number>

<CRLF> ::= <CR> <LF>

<CR> ::= the carriage return character (ASCII code 13)

<LF> ::= the line feed character (ASCII code 10)

<SP> ::= the space character (ASCII code 32)

<snum> ::= one, two, or three digits representing a decimal
integer value in the range 0 through 255

<a> ::= any one of the 52 alphabetic characters A through Z
in upper case and a through z in lower case

<c> ::= any one of the 128 ASCII characters, but not any
<special> or <SP>

<d> ::= any one of the ten digits 0 through 9

<q> ::= any one of the 128 ASCII characters except <CR>,
<LF>, quote ("), or backslash (\)

<x> ::= any one of the 128 ASCII characters (no exceptions)

<special> ::= "<" | ">" | "(" | ")" | "[" | "]" | "\" | "."
| "," | ";" | ":" | "@" """ | the control
characters (ASCII codes 0 through 31 inclusive and
127)

バックスラッシュ "\" は引用文字であり、次の文字を (通常の解釈ではなく) そのままの意味で使うことを示すために用いられることに注意する。例えば、"Joe\,Smith" は、カンマが 4 番目の文字である、9 文字から成る単一のユーザー・フィールドを示すために使える。

ホストは一般に名前で知られており、その名前は各ホストでアドレスに変換される。ドメインの名前要素は正式名であり、ニックネームや別名の使用は認められないことに注意する。

ホストが変換機能に知られておらず、通信が阻まれることがある。この障壁を回避するため、ホスト「名」には二つの数値形式も認められている。一つは、シャープ記号 "#" を前置した十進整数で、その数がホストのアドレスであることを示す。もう一つは、ドットで区切って角括弧で囲んだ四つの小さな十進整数で、例えば "[123.255.37.2]" のように、四つの 8 ビット・フィールドから成る 32 ビットの ARPA インターネット・アドレスを示す。

タイムスタンプ行とリターン・パス行は、次のように正式に定義される。

<return-path-line> ::= "Return-Path:" <SP><reverse-path><CRLF>

<time-stamp-line> ::= "Received:" <SP> <stamp> <CRLF>

<stamp> ::= <from-domain> <by-domain> <opt-info> ";"
<daytime>

<from-domain> ::= "FROM" <SP> <domain> <SP>

<by-domain> ::= "BY" <SP> <domain> <SP>

<opt-info> ::= [<via>] [<with>] [<id>] [<for>]

<via> ::= "VIA" <SP> <link> <SP>

<with> ::= "WITH" <SP> <protocol> <SP>

<id> ::= "ID" <SP> <string> <SP>

<for> ::= "FOR" <SP> <path> <SP>

<link> ::= The standard names for links are registered with
the Network Information Center.

<protocol> ::= The standard names for protocols are
registered with the Network Information Center.

<daytime> ::= <SP> <date> <SP> <time>

<date> ::= <dd> <SP> <mon> <SP> <yy>

<time> ::= <hh> ":" <mm> ":" <ss> <SP> <zone>

<dd> ::= the one or two decimal integer day of the month in
the range 1 to 31.

<mon> ::= "JAN" | "FEB" | "MAR" | "APR" | "MAY" | "JUN" |
"JUL" | "AUG" | "SEP" | "OCT" | "NOV" | "DEC"

<yy> ::= the two decimal integer year of the century in the
range 00 to 99.

<hh> ::= the two decimal integer hour of the day in the
range 00 to 24.

<mm> ::= the two decimal integer minute of the hour in the
range 00 to 59.

<ss> ::= the two decimal integer second of the minute in the
range 00 to 59.

<zone> ::= "UT" for Universal Time (the default) or other
time zone designator (as in [2]).
-------------------------------------------------------------

Return Path Example

Return-Path: <@CHARLIE.ARPA,@BAKER.ARPA:[email protected]>

Example 9

-------------------------------------------------------------
-------------------------------------------------------------

Time Stamp Line Example

Received: FROM ABC.ARPA BY XYZ.ARPA ; 22 OCT 81 09:23:59 PDT

Received: from ABC.ARPA by XYZ.ARPA via TELENET with X25
id M12345 for [email protected] ; 22 OCT 81 09:23:59 PDT

Example 10

-------------------------------------------------------------