Introduction to the POP protocol
(Author: Chen Junqing October 18, 2000 11:53)
This paper briefly describes the principle of receiving the decoding of mail and MIME messages through the POP3 protocol, and provides two useful PHP classes for collecting and mime decoding, and provides examples of using. It is divided into two parts: Mail charge and MIME decoding. Here we first introduce you to the mail collection, decoding part will be in a future article for you detailed introduction, please pay attention.
Now the largest application on the Internet should be non-email, we are accustomed to daily through the exchange of email, the major sites have also almost launched their own web-based free mail system. In this article, I will introduce some of the principles of e-mail implementation. At the same time, we assume that you have a certain basis for PHP programming, the TCP/IP protocol also has a certain understanding.
Introduction to the POP protocol
The full name of the pop is the post Office Protoco, the Post Office Protocol, which is used for e-mail reception, and is now commonly used in the third edition, referred to as POP3. Through the POP protocol, after the client logs on to the server, can delete their own messages, or download to the local, after downloading, the e-mail client software can be local to the message to modify, delete, and so on. Another message for receiving letters is the IMAP protocol, which is now developing quickly, and we will not discuss it in this article.
The POP server typically uses TCP port 110th, and if you use Foxmail, you can see some of the commands in the message prompt window when you receive it:
"Connecting to 220.127.116.11:110";
"PASS ...";; ";";
Let's look at a transcript of a conversation with the POP3 server:
Telenet pop.china.com 110
+ok AIMC POP Service (mail2.china.com) is ready.
+ok Please enter password for user .
+ok Boss_ch has 1 messages (octets)
+ok 1 750
+ok 1 messages (octets)
Received:from smtp2.ptt.js.cn ([18.104.22.168]) by china.com (JetMail 22.214.171.124)
with SMTP ID jm4839cc4227; Sat, SEP 2000 05:31:21-0000
Received:from chenjunqing ([126.96.36.199]) by smtp2.ptt.js.cn
(Netscape Messaging Server 4.15) with SMTP ID g1brhj03. V07 for
; Sat, SEP 2000 13:34:31 +0800
Date:sat, SEP 2000 13:34:18 +0800
From: =? Iso-8859-1? q?=b3=c2=bf=a1=c7=e5?=
Subject: =? Iso-8859-1? q?=d3=ca=bc=fe=ca=be=c0=fd?=
X-mailer:foxmail 3.1 [CN]
Content-type:text/plain; charset= "GB2312"
This is a small example of a message
+ok Pop Server at Signing off.
Here is a brief introduction to several commonly used POP3 commands:
Command parameter Status description
USER Username recognizes that this command and the following pass command, if successful, will result in a state transition
PASS Password Approval
APOP name,digest recognition Digest is MD5 message digest
Stat None processes the request server to send back statistics about the mailbox, such as the total number of messages and the total number of bytes
UIDL [msg#] handles the unique identifier of the returned message, and each identifier for the POP3 session will be unique
LIST [msg#] handles the number of messages returned and the size of each message
RETR [msg#] processing returns all the text of the message identified by the parameter
DELE [msg#] processing server marks the message identified by the parameter for deletion, executed by the QUIT command
RSET None processing server resets all messages marked for deletion to undo the dele command
Top [msg#] processing server returns the first n rows of the message identified by the parameter, n must be a positive integer
NOOP None The processing server returns a positive response and does nothing.
Quit None Update exits