Send and receive emails under the command line

Source: Internet
Author: User

Today, I saw the introduction on the Internet and used the command line to send and receive emails.

Receive email:

  1. Open the "run" dialog box in the "Start" menu and enter the Telnet command and the remote server port number, for example:
    Telnet to pop3.163.com 110The connection will be established with the POP3 server pop3.163.com of "Netease 163 free mail.
  2. 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])
  3. User greenerycnIf the user name is successfully logged on, the POP3 server returns the following information:
    + OK core mail
  4. Enter PasswordPass passwordIf successful, 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. StatCommand Format: staTNo parameters required
2.ListCommand Format: list [N] parameter n (Optional). n is the mail number.
3.UIDL command format: UIDL [N] Same as above
4.RETRCommand Format: RETR n parameter n is not saving, n is the mail number
5.DeleCommand Format: Same as DELE n
6.TopCommand Format: Top n m parameter n, m is not saving, n is the mail number, M is the number of rows
7.NoopCommand Format: Noop requires no parameters
8.QuitCommand 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// Log on to smtp.163.com and set the port number to 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 server the sender's address
250 mail OK
Rcpt to: <Yourframe@21cn.com>// Tell the recipient's address on the server
250 mail OK
Data// Start the transmission of the mail content on the front, and end 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,# The Body of the email, with a blank line from the header

Test body
.# After the email is written, enter the result with a period and press Enter.
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. If the request email is completed (Helo, mail from, rcpt to, this message is returned if the quit command is executed successfully) 235: authentication successful: processing 354: Start sending data, end. (this message is returned when the data command is successfully executed.) 500: syntax error. The command cannot be identified. 550: The command cannot be executed. The mailbox is invalid. 552: the user exceeds the file space.

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.