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

4.2. SMTP の応答

SMTP コマンドへの応答は、メール転送の過程で要求と動作の同期を確保し、送信側 SMTP が常に受信側 SMTP の状態を把握できるようにするために考案されている。すべてのコマンドは、ちょうど一つの応答を生成しなければならない。

コマンドと応答のシーケンスの詳細は、シーケンスを扱う 5.3 節と、状態遷移図を扱う 5.4 節で明示される。

SMTP の応答は、3 桁の数字 (3 文字の英数字として伝送される) と、それに続くテキストから成る。数字は、オートマトンが次に入る状態を判断するためのものであり、テキストは人間のユーザー向けである。3 桁の数字には、送信側 SMTP がテキストを調べなくてもよいだけの十分な符号化された情報が含まれることが意図されており、送信側 SMTP は、テキストを破棄しても、適宜ユーザーに渡してもよい。特に、テキストは受信側ごと、また文脈ごとに異なり得るため、各応答コードに対して異なるテキストが使われる可能性が高い。応答コードの理論については、付録 E で論じる。正式には、応答は、3 桁のコード、<SP>、1 行のテキスト、<CRLF> の並び、または (付録 E で定義される) 複数行の応答として定義される。通常の状況で複数行の応答になると想定されるのは EXPN コマンドと HELP コマンドだけだが、複数行の応答はどのコマンドに対しても認められる。

4.2.1. 機能グループ別の応答コード​

500 Syntax error, command unrecognized
[This may include errors such as command line too long]
501 Syntax error in parameters or arguments
502 Command not implemented
503 Bad sequence of commands
504 Command parameter not implemented

211 System status, or system help reply
214 Help message
[Information on how to use the receiver or the meaning of a
particular non-standard command; this reply is useful only
to the human user]

220 <domain> Service ready
221 <domain> Service closing transmission channel
421 <domain> Service not available,
closing transmission channel
[This may be a reply to any command if the service knows it
must shut down]

250 Requested mail action okay, completed
251 User not local; will forward to <forward-path>
450 Requested mail action not taken: mailbox unavailable
[E.g., mailbox busy]
550 Requested action not taken: mailbox unavailable
[E.g., mailbox not found, no access]
451 Requested action aborted: error in processing
551 User not local; please try <forward-path>
452 Requested action not taken: insufficient system storage
552 Requested mail action aborted: exceeded storage allocation
553 Requested action not taken: mailbox name not allowed
[E.g., mailbox syntax incorrect]
354 Start mail input; end with <CRLF>.<CRLF>
554 Transaction failed

4.2.2. 応答コードの数値順一覧​

211 System status, or system help reply
214 Help message
[Information on how to use the receiver or the meaning of a
particular non-standard command; this reply is useful only
to the human user]
220 <domain> Service ready
221 <domain> Service closing transmission channel
250 Requested mail action okay, completed
251 User not local; will forward to <forward-path>

354 Start mail input; end with <CRLF>.<CRLF>

421 <domain> Service not available,
closing transmission channel
[This may be a reply to any command if the service knows it
must shut down]
450 Requested mail action not taken: mailbox unavailable
[E.g., mailbox busy]
451 Requested action aborted: local error in processing
452 Requested action not taken: insufficient system storage

500 Syntax error, command unrecognized
[This may include errors such as command line too long]
501 Syntax error in parameters or arguments
502 Command not implemented
503 Bad sequence of commands
504 Command parameter not implemented
550 Requested action not taken: mailbox unavailable
[E.g., mailbox not found, no access]
551 User not local; please try <forward-path>
552 Requested mail action aborted: exceeded storage allocation
553 Requested action not taken: mailbox name not allowed
[E.g., mailbox syntax incorrect]
554 Transaction failed