5.3. Sequencing of Commands and Replies
The communication between the sender and receiver is intended to be an alternating dialogue. As such, the sender issues an MTP command and the receiver responds with a prompt primary reply. The sender should wait for this response before sending further commands.
The preliminary (1xx) and intermediate (3xx) replies indicate that further commands and information are required to complete the required action. The preliminary replies require either a continue or abort command to proceed; the intermediate replies require action dependent further commands.
One important reply is the connection greetings. Under normal circumstances, a receiver will send a 220 "Awaiting input" reply when the connection is completed. The sender should wait for this greeting message before sending any commands. If the receiver is unable to accept input right away, it should send a 120 "Expected delay" reply immediately. The sender can then indicate it is willing to wait via a continue command, or not via the abort command. The receiver will respond to the abort with a 201 reply, and to the continue with the 220 reply when ready.
Note: all the greeting type replies have the official name of the server host as the first word following the reply code.
For example,
220 <SP> USC-ISIF <SP> Service ready <CRLF>
The table below lists alternative success and failure replies for each command. These must be strictly adhered to; a receiver may substitute text in the replies, but the meaning and action implied by the code numbers and by the specific command reply sequence cannot be altered.
Command-Reply Sequences
Each command is listed with its possible replies. Preliminary replies are listed first with their succeeding replies indented under them, then success and failure completion, and finally intermediary replies with the remaining commands from the sequence following. The prefixes used before the possible replies are "P" for preliminary, "I" for intermediate, "S" for success, "F" for failure, and "E" for error. The 421 reply (service not available, closing transmission channel) may be given to any command if the MTP-receiver knows it must shut down. This listing forms the basis for the State Diagrams, in Section 5.4.
CONNECTION ESTABLISHMENT
P: 120 -> CONT -> S: 220
F: 421
ABRT S: 201
F: 421
S: 220
F: 421
MAIL
P: 151 -> CONT -> I: 354 -> text -> S: 250
152 F: 451,552,450,
550,452,553
ABRT -> S: 201
F: 451,552,450,550,452,553
I: 354 -> text -> S: 250
F: 451,552,450,550,452,553
F: 451, 552, 450, 550, 452, 553
E: 500, 501, 502, 421
MRSQ
S: 200, 215
E: 500, 501, 502, 504, 421
MRCP
P: 151 -> CONT -> S: 200, 215, 250
152 F: 451,552,450,550,452,553
ABRT -> S: 201
F: 451,552,450,550,452,553
S: 200, 215, 250
F: 451, 552, 450, 550, 452, 553
E: 500, 501, 502, 503, 421
QUIT
S: 221
E: 500, 421
HELP
S: 211, 214
E: 500, 501, 502, 504, 421
NOOP
S: 200
E: 500, 421
CONT
S: depends on previous command
F: depends on previous command
E: 500, 501, 502, 504, 421
ABRT
S: 201,
E: 500, 501, 502, 504, 421