Server commands for SMTP, POP3, nntp, FTP, and HTTP
SMTP commands
1. mail from: <sender address> <CRLF>; Identify the sender address to the recipient.
2. rcpt to: <recipient address> <CRLF>; identifies the recipient address.
3. Data <CRLF>; request to send message data. Each row ends with <CRLF> and a row with only.
4. Quit <CRLF>; close the connection.
Common HTTP commands
For HTTP servers, you only need to send a GET command in the following format:
Get <path> HTTP/1.0 <CRLF>
The path is the valid path on the server or the file name with the complete path. After the command is issued, the server returns a set of data and disconnects you. This set of data is generally divided into two parts: the header and the file data. The header generally starts with "HTTP/1.x 200 OK" to indicate success. If "200" is "404", the file is not found, if other numbers are used, the operation fails. The header ends with <CRLF>, followed by the file data you need.
The following is an instance where ie5.0 sends a request to the server:
Get, HTTP, 1.1
Accept :*/*
Accept-language: ZH-CN
Accept-encoding: gzip, deflate
If-modified-since: Mon, 07 Aug 2000 04:02:46 GMT
If-None-Match: "0b7e757240c01: 1bce"
User-Agent: Mozilla/4.0 (compatible; MSIE 5.0; Windows 98; digext)
HOST: Dong
Connection: keep-alive
The following is an example of data returned by the HTTP service:
HTTP/1.1 200 OK
Server: Microsoft-Microsoft IIS/4.0
Content-location: http: // 202.103.202.203/default.htm
Date: sat, 26 Aug 2000 02:15:07 GMT
Content-Type: text/html
Accept-ranges: bytes
Last-modified: Mon, 07 Aug 2000 04:02:46 GMT
Etag: "0b7e757240c01: 1c5a"
Content-Length: 628
<HTML>
<Head>
<Meta HTTP-EQUIV = "Content-Type" content = "text/html; charset = gb2312">
<Meta name = "generator" content = "Microsoft FrontPage 4.0">
<Meta name = "progid" content = "FrontPage. Editor. Document">
<Title> Xudong website </title>
</Head>
<Frameset rows = "95, *" framespacing = "0" border = "0" frameborder = "0">
<Frame name = "Header" scrolling = "no" noresize target = "Main" src = "dong_bt.htm" marginwidth = "12" marginheight = "0">
<Frame name = "Main" src = "dong_zy.htm" target = "_ Self" scrolling = "Auto">
<Noframes>
<Body>
<P> This webpage uses a framework, but your browser does not support the framework. </P>
</Body>
</Noframes>
</Frameset>
</Html>
POP3 commands
The POP3 server response is generally "+ OK", indicating success, and "-Err" indicates failure.
1. User <User Name> <CRLF>; user logon.
2. Pass <password> <CRLF>; send the user password.
3. Stat <CRLF>; return the mailbox list (number of mails and bytes ).
4. DELE <email no.> <CRLF>; Delete the specified email.
5. List <email no.> <CELF>; return the specified email header.
6. RETR <email no.> <CRLF>; returns the specified email, ending with a row with only one.
7. Quit <CRLF>; close the connection.
Common NNTP commands
1. Article [<article number or message id>] <CRLF>; returns the specified article, ending with a row containing.
2. List <CRLF>; returns a list of newsgroups.
3. group <newsgroup Name> <CRLF>; select a newsgroup.
4. Last <CRLF>; move the pointer of the current article to the previous article.
5. newgroup <yymmdd>
6. newnews <newsgroup Name> <yymmdd>
7. Post <CRLF>; request to post a new article. If "340" is returned, the message can be sent. Next, the message content can be sent. Each row ends with <CRLF> and ends with a row with only one. If the server returns "400", no post is allowed.
FTP commands
1. User <User Name> <CRLF>; Note: <CRLF> indicates a carriage return line break.
Specify the username to log on to. After you connect to the FTP server, you will receive a response starting with 200. This indicates that the server is ready. You can use this command to log on, after the command is issued, a response starting with 230 indicates that the user has logged on, or a response starting with 331 indicates that the password is required.
2. Pass <password> <CRLF>
When the server responds to 331 and requires a password, use this command to send the password to the server. After the command is sent, you will receive a 230 response, indicating that you have logged on. Please continue, or the 530 response indicates that you cannot log on.
3. Port H1, H2, H3, H4, P1, P2 <CRLF>
Specify an IP address and local port for the data connection. The h1-h4 is the IP address of the Internet host, P1 is the high byte of the local port, and P2 is the low byte of the local port.
4. appe <File Name> <CRLF>
Let the server prepare to receive a file and append the data to the specified file. If the specified file does not exist, create it. The server will respond: 125-> data connection is enabled, transmission is started; 150-> prepare to open data connection; 226-> close data connection, operation successful; 250-> completed; 421-> service unavailable; 425-> data connection cannot be opened; 450, 532, 550, 553-> cannot be executed.
5. CWD <path> <CRLF>
Change the current directory to a specified directory (such as the dos CD command ). Server Response: 250-> completed; 421 or 550-> failed.
6. DELE <File Name> <CRLF>
Deletes a specified file on the server. Server Response: 250-> completed; 421, 450, 550-> not executed.
7. list [<path>] <CRLF>
List the file names in the specified path (such as the DOS dir command ). The server response is the same as that of appe.
8. MKD <path> <CRLF>
Create a directory on the server. Server Response: 257-> created; 421, 550-> cannot be executed.
9. pwd <CRLF>; returns the name of the current directory.
10. Quit <CRLF>. log out of the user and terminate the connection.
11. RETR <File Name> <CRLF>; download the file, and the server response is the same as that of appe.
12. RMD <path> <CRLF>; deletes a directory, and the server responds with the same DELE.
13. RNFR <File Name> <CRLF>
Rename the first half of a file. The file name is a valid file name on the server. Server Response: 350-> wait for further information; 421, 450, 550-> cannot be executed.
14. RNTO <File Name> <CRLF>
Rename the last half of a file with the new file name. Server Response: 250-> completed; 421, 532, 553-> not executed.
15. stor <File Name> <CRLF>. The server receives the file from the data connection and returns the same response as appe.