Use telnet to send and receive emails quickly --

Source: Internet
Author: User
Tags file transfer protocol

When talking about sending and receiving emails, we can't help but talk about the two network protocols closely related to email transmission, namely POP3 and SMTP, these two protocols are the core of email receiving and sending, among which:

POP3 indicates the Post Office Protocol version 3, which is the mail box Protocol and is responsible for receiving emails. SMTP refers to Simple Mail Transfer Protocol, which refers to the Simple Mail transmission protocol and is responsible for sending emails.

These two protocols can also be called two major services on the Internet. Users can conveniently manage their emails on remote computers on servers that support these two services. Currently, many websites in China provide free email addresses and the two services and their corresponding servers. The following lists them:

SMTP Server
Zhonghua network pop.china.com smtp.china.com
Sohu pop.sohu.com smtp.sohu.com
Netease pop.163.com smtp.163.com
Sina pop3.sina.com smtp.sina.com
163 Electronic Post Office 163.net smtp.163.net
263 email Post Office 263.net smtp.263.net

Learn more about POP3, SMTP, and servers. Next, let's take a look at a network genie, a communication port, which is closely related to POP3 and other network protocols, A communication port is actually an application corresponding to a specific host. When an external computer is connected to a server, the server must open a port to complete the user's request, if the port cannot be opened, it means that the user cannot connect to the server, and this channel cannot be established. Therefore, the port plays an extremely important role in network communication.

The following lists the ports corresponding to the special services on the Internet:

Telnet port: 23 (Remote logon)
Http port: 80 (Hypertext Transfer Protocol)
FTP port: 21 (file transfer protocol)
DNS port: 53 (Domain Name Service System)
POP3 port: 110 (mail box Protocol)
SMTP port: 25 (Simple Mail Transfer Protocol)

Of course, you only need to know that the POP3 protocol port is 110, and the SMTP protocol port is 25. The above POP3 and SMTP servers have extremely corresponding communication ports, next we will learn how to use Telnet, a remote logon tool provided by windwos, to receive and send emails. The telnet tool runs under the Windows installation directory by double-clicking it. The main interface 1 shows that it has four options on the main menu. The usage and functions of each option are as follows:

Connection: establishes a connection with a remote computer (server or host), short-start connections, and exits the Telnet system.

Edit: edits information on the terminal, such as copying and pasting.

Terminal: controls the terminal and sets various parameters, such as whether to allow the terminal to display user input information and change the background color of the terminal, record the information on the terminal to a moderate log file.

Help: The help system provided by Telnet.

By default, the information entered by the user is not displayed on the terminal (that is, the terminal only displays the Information responded by the remote server, if you want to display the information you entered only on your terminal, you can set it like this to open the "Terminal/preferred" dialog box on the main menu, select the "local response" item, as shown in figure 2.

So how can we establish a connection with a remote server? There are two ways to achieve this:

Method 1: Open the "run" dialog box in the "Start" menu and enter the Telnet command and the remote server port number, for example:
: Telnet pop.china.com 110 will establish a connection with the POP3 server pop.china.com of "China Net.

Method 2: On the telnet interface, open the "Connect/remote system" dialog box on the main menu, enter "pop.china.com" in "Host Name", and enter "110" in "Port, the terminal type uses the default VT100. After this setting, the execution result is the same as that of method 1.

If the connection is successful, the POP3 server will respond to the following information (displayed on the terminal ):

+ OK AIMC POP service (mail0.china.com) is ready.

After a brief introduction to the Telnet tool, we will learn how to use the Telnet tool to receive and send e-mail, in my e-mail xu_xifeng@china.com as an example to explain (password ), obviously, this mailbox is on the "China Net". To receive an email from "China Net", you must first log on to the POP3 server of the Chinese net, after the logon is successful, enter the following command (the USER command is used to connect to the logon user name, the PASS command is used to connect to the mailbox password, separated by spaces ):

User xu_xifeng
If the user name is successfully logged on, the POP3 server returns the following information:
+ OK please enter password for user. (line 2 and 3 of 4)
Enter the password pass password immediately. If the password is successful, the following information will be displayed:
+ OK xu_xifeng has 5 message (2294 octets) (Lines 4 and 5 of 4)
The number 5 indicates five messages, and 2294 indicates the total number of bytes (2294b) of these five messages, to which the xu_xifeng@china.com has successfully logged on, after entering the mailbox, you can use the following command:

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 ..
How can I use Telnet to send an email? Due to the weak Telnet mail function (it can only send some simple emails), it is not commonly used or practical, so I will just give you a brief introduction here, you can use Telnet to send emails.

Similar to sending an email, before sending an email, we must first establish a connection with the same SMTP server, or use the mail server on the Chinese network as an example to open the "connection/remote system" dialog box, enter smtp.china.com in "Host Name" and enter "25" in "Port". The terminal type still uses the default VT100 to establish a remote connection. If the connection is successfully established, the remote SMTP server will respond to the following information:

220 **************************************

After receiving this information, you can use the following commands in sequence (Note: The order cannot be changed) to send emails.

Step1. enter the helo xuxifeng command.

If the request (command) is successfully accepted, the remote SMTP server will respond to the following information:

250 china.com, xuxifeng <211.91.133.66> okay.
Step2. enter the command mail from:

If the request is successfully accepted, the remote SMTP server will respond to the following information:
250, sender OK.

Step3. enter the command rcpt:

If the request is successfully accepted, the remote SMTP server will respond to the following information:
250, local recipient OK.

Step 4. Enter the command data

If the request is successfully accepted, the remote SMTP server will respond to the following information:
354 start mail input; end.

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.