How to send and receive emails in command line (dos)
Source: Internet
Author: User
Today, I saw the introduction on the Internet and used the command line to send and receive emails.
Receive email:
Open the "run" dialog box in the "Start" menu and enter the telnet command and the remote server port number, for example:
Telnet pop3.163.com 110 will establish a connection with "Netease 163 free mail" pop3 server pop3.163.com.
If the connection is successful, the POP3 server will respond to the following information (displayed on the terminal ):
+ OK Welcome to coremail Mail Pop3 Server (163com [20050206])
User greenerycn if the user name is successfully logged on, the POP3 server will respond to the following information:
+ OK core mail
If the password pass password is entered successfully, the following information is displayed:
+ OK 5 message (2267 octets)
The number 5 indicates five emails, and 2267 indicates the total number of bytes (2267B) of the five emails ),
The Command Format and parameters are described as follows:
1. stat Command Format: no parameters are required for stat.
2. list Command Format: list [n] parameter n (Optional). n is the mail number.
3. uidl Command Format: uidl [n] Same as above
4. retr Command Format: retr n parameter n cannot be saved, and n is the mail number
5. dele Command Format: Same as dele n
6. top Command Format: top n m parameter n, m is not saving, n is the mail number, m is the number of rows
7. noop Command Format: no parameters are required for noop
8. quit Command Format: quit does not require parameters
For detailed functions of each command, see the following description:
1. The stat command does not contain parameters. For this command, the POP3 server returns a correct response, which is a single-line message prompt starting with "+ OK, then there are two numbers, the first is the number of mails, and the second is the size of the mail, for example, + OK 4 1603
2. The list command is optional. this parameter is a number that indicates the number of the email in the mailbox. We can use the list Command without parameters to obtain the number of each email, in addition, each email occupies one row and is displayed. The preceding number indicates the number of the email, and the following number indicates the size of the email.
3. the uidl Command is similar to the list Command, except that the uidl command displays more detailed information about the email than the list command. The execution result is 4.
4. the retr command is the most important command to receive emails. It is used to view the content of emails. It must contain parameters. After the command is executed, the server has a long response information, the information includes the sender's email address, sending time, And subject. The information is collectively referred to as the mail header. The information that follows the mail header is the mail body.
5. the dele command is used to delete a specified email. (Note: the dele n command only marks the deletion of the email. The mail will be deleted only after the quit command is executed ), the deleted response information is shown in section 6.
6. The top command has two parameters, for example, top n m n is the mail number, and m is the number of lines to read the mail body. If m is 0, only the mail header is read.
7. noop command. After this command is issued, the POP3 server returns only one correct response "+ OK" without doing anything"
8. quit command. After the command is issued, telnet is disconnected from the POP3 server and the system enters the update status ..
However, google emails are encoded in this way and cannot be viewed in Chinese.
Dos sending
1. Calculated username and password base64 encoding: http://lishiditu.008.net/base64.html
[Telnet smtp.163.com 25 // The port number for logging on to smtp.163.com is 25
220 163.com Anti-spam GT for Coremail System (163com [20050206])
HELO localhost // greet the server and inform the client of the name of the machine used.
250 OK
Auth login // use the identity authentication logon command
334 dXNlcm5hbWU6
YWJj // enter the username that has passed base64_encode.
334 UGFzc3dvcm
MTIzNDU2 // enter the base64_encode () password
235 Authentication successful
Mail from: <greenerycn@163.com> // tell the address of the server sender
250 Mail OK
Rcpt to: <yourframe@21cn.com> // tell the server recipient's address
250 Mail OK
DATA // the content of the mail starts to be transmitted on the front and ends with a special line containing only.
354 End data with <CR> <LF>. <CR> <LF>
To: yourframe@21cn.com
From: redsos3@163.com
Subject: test mail
Test, # Body of the email, with a blank line with the Header
Test body
. # After the email is completed, enter the result with a period.
250 Mail OK queued as smtp14, F0CPBFsuzUOvoDwE. 10982s2
QUIT // disconnect
221 Bye
Connection closed by foreign host.
Status Code Description:
220: Service ready
250: The request email is correct and completed (HELO, mail from, rcpt to, QUIT command execution will return this message)
235: certified
221: Processing
354: Start sending DATA and end with. (This message will be returned if the DATA command is executed successfully)
500: syntax error. The command cannot be identified
550: The command cannot be executed, and the email address is invalid.
552: interrupt handling: the user exceeds the file space
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.