Basic structure of SMTP
The SMTP (Simple Mail Transfer Protocol) protocol is designed to ensure reliable and efficient delivery of e-mail. The TCP/IP protocol has an SMTP protocol in the application layer, but in fact it has nothing to do with the transport system and mechanism, requiring only a reliable data flow path. It can work on TCP, and it can work on protocols such as NCP, NITs, and so on. On TCP, it uses port 25 for transmission. An important feature of SMTP is that you can send mail in an interactive communication system.
1. Model of SMTP
SMTP provides a mechanism for message transmission that through balls messages to each other when both the recipient and the sender are on a network, and is forwarded through one or more intermediary servers when both are not on the same network. SMTP is first requested by the sender to establish a two-way communication channel with the recipient SMTP, which can be either the final recipient or the intermediate forwarding server. When the recipient's server confirms that a connection can be made, it can begin communication. The following is a schematic diagram of the SMTP model.
The sender SMTP notifies the recipient of the identity of the sender by sending a mail command, and if the recipient accepts it, it will answer OK. The sender then issues the RCPT command to inform the recipient of the identity of the receiver, SMTP confirm whether to receive or forward, if agreed to answer OK; then you can transfer the data. In the communication process, the sender of SMTP and the recipient of SMTP using a dialogue-style interaction, the sender of the request, the recipient to confirm, confirmed before the next move. The whole process is controlled by the sender, and sometimes it needs to be validated several times.
To ensure that the reply command is valid, SMTP requires the sender to provide the recipient's server and mailbox. The commands and replies to a message have a strict syntax definition, and the reply has a corresponding numeric code. All commands are made up of ASCII code. The command code is case insensitive, as mail and Mail﹑mail are equivalent.