Because of its simplicity and convenience, email has become the most successful application on the Internet. There are thousands of email servers on the Internet to provide services for users. Each server has dozens to millions of or more user mailboxes. Users send and receive emails through user agents such as FoxMail and MS Express. The content of the emails includes the common text information, you can also append information such as images, audios, and videos. The SMTP, POP3, and MIME protocols are used to ensure normal mail exchange. On the mail server, a file system is generally used to store users' emails. The sending server and the receiving email server may not be the same. The email server in the same domain can form a server group in a distributed structure. The email server can also define the mailbox alias for forwarding.
1. SMTP Simple Mail Transfer Protocol)
In 1982, SMTPRFC 821 and RFC 822 were developed. SMTP describes how two processes exchange information. The mail message format specifies the specific format of the mail.
An email consists of the header and the body. The body is the content of the email. the header consists of keywords, colons, and key information. The typical header is as follows:
Date:
From: a@ B .c.d
To: abc@def.ghi.jkl; 123@456.789
Subject: abcdefg
HTTP: aa@bb.cc.dd
BCC: 1@2.3.4
Reply-:
The process of sending and receiving mails using SMTP is: establishing TCP Connection Service port number 25), sending mails, releasing connections.
Mail sending command:
If the DATA command is received, the receiver returns a 354 Intermediate response, and determines that the following lines are the mail content. After receiving and storing the ending letter, the receiver sends a 250 OK response. Because the email is sent through the transmission channel, you must specify the end of the message so that the reply dialog can start again. SMTP sends only one full stop message in the last line to indicate the end of the mail content. In the receiver, this symbol is filtered out in a transparent process to the user, so that normal data is not affected.
HELO
MAIL FROM:
RCPT TO:
DATA
RSET
SEND FROM:
SOML FROM:
SAML FROM:
VRFY
EXPN
HELP [ ]
NOOP
QUIT
TURN
Email response:
500 format error. The command cannot recognize this error. The command line is too long)
501 Incorrect Parameter format
502 commands cannot be implemented
503 error command sequence
504 command parameters cannot be implemented
211 system status or system help response
214 help information
220 Service ready
221 Service disables the transmission channel
421 The service is not ready. If the transmission channel is disabled, this response can be used as a response to any command)
250 the required email operation is completed
251 the user is not local and will forward
450 the email operation is not completed, and the mailbox is unavailable for example, the mailbox is busy)
550 the requested email operation is incomplete, and the email address is unavailable. For example, the email address is not found or cannot be accessed)
451 discard required operations; errors occurred during handling
551 users are not local. Please try
452 the system storage is insufficient and the required operations are not performed
552 excessive storage allocation, required operations not performed
553 the mailbox name is unavailable. The required operation is not performed, for example, the mailbox format is incorrect)
354 start email input, . End
554 operation failed
Example:
R: 220 BBN-UNIX.ARPA Simple Mail Transfer Service Ready
S: HELO USC-ISIF.ARPA
R: 250 BBN-UNIX.ARPA
S: mail from:
R: 250 OK
S: rcpt:
R: 250 OK
S: rcpt:
R: 550 No such user here
S: rcpt:
R: 250 OK
S: DATA
R: 354 Start mail input; end .
S: Blah blah...
S:... etc. etc.
S :.
R: 250 OK
S: QUIT
R: 221 BBN-UNIX.ARPA Service closing transmission channel