Introduction: This is a detailed page for collecting POP3 mails using PHP (1). It introduces PHP, related knowledge, skills, experience, and some PHP source code.
Class = 'pingjiaf' frameborder = '0' src = 'HTTP: // biancheng.dnbc?info/pingjia.php? Id = 324421 'rolling = 'no'>
POP Protocol Introduction
This article briefly describes the principles of receiving and mime mail through POP3 protocol, provides two practical PHP classes for receiving and MIME Decoding, and provides samples for use. It is divided into two parts: email receiving and MIME Decoding. Here we will first introduce you to the receipt of emails, and the decoding part will be laterArticleFor your detailed introduction, please stay tuned.
Currently, the largest application on the Internet should be non-email. Every day, we are used to communicating via email every day. Almost all major websites have launched their own web-based free email system. In this article, I will introduce some principles of email implementation. At the same time, we assume that you have a certain foundation for PHP programming and a certain understanding of the TCP/IP protocol.
POP Protocol Introduction
Pop stands for post office protoco, which is the post office protocol used for email reception. It is now commonly used in the third edition, POP3 for short. Through the POP protocol, after the client logs on to the server, it can delete its own emails, or download it to the local device. After the download, the email client software can modify and delete emails locally. The IMAP protocol is also used to receive emails, which is growing rapidly. We will not discuss this in this article.
POP servers generally use port 110 of TCP. If Foxmail is used, you can see the following command in the prompt window:
"Connecting to 62.123.23.123: 110 ";
"User boss_ch ";
"Pass ..............";
Let's take a look at the transcript of a conversation with the POP3 server:
Telenet pop.china.com110
+ OK AIMC POP service (mail2.china.com) is ready.
User boss_ch
+ OK please enter password for user.
Pass ******
+ OK boss_ch has 1 messages (750 octets)
Stat
+ OK 1 750
List
+ OK 1 messages (750 octets)
1 750
RETR 1
+ OK 750 octets
Received: From smtp2.ptt.js.cn ([202.102.24.37]) by china.com (jetmail 2.5.3.0)
With smtp id jm4839cc4227; sat, 23 Sep 2000 05:31:21-0000
Received: From chenjunqing ([61.155.120.6]) by smtp2.ptt.js.cn
(Netscape Messaging Server 4.15) with smtp id g1brhj03. v07
; Sat, 23 Sep 2000 13:34:31 + 0800
Date: sat, 23 Sep 2000 13:34:18 + 0800
From: =? ISO-8859-1? Q? = B3 = C2 = BF = A1 = C7 = E5? =
To: boss_ch@china.com
Subject: =? ISO-8859-1? Q? = D3 = CA = BC = Fe = CA = be = C0 = FD? =
X-mailer: Foxmail 3.1 [CN]
Mime-type: 1.0
Content-Type: text/plain; charset = "gb2312"
Content-transfer-encoding: 8bit
Message-ID:
Hello!
This is a small example of an email.
Quit
+ OK POP server at signing off.
The following is a brief introduction to several frequently-used POP3 commands:
Command Parameter status description
------------------------------------------
User Username recognizes that if this command is successful with the following PASS Command, status conversion will occur.
Pass password approval
APOP name, digest recognizes that digest is the MD5 message digest
------------------------------------------
Stat none processes the mailbox statistics sent back by the request server, such as the total number of emails and total bytes.
UIDL [MSG #] indicates the unique identifier of the Response Message. Each identifier of a POP3 session will be unique.
List [MSG #] Number of returned mails processed and size of each email
RETR [MSG #] process and return all text of the email identified by Parameters
Dele [MSG #] The processing server marks the emails marked by parameters as deleted and is executed by the quit command.
Rset none processing server resets all emails marked as deleted, used to cancel the DELE Command
Top [MSG #] The processing server will return the content of the first n lines of emails identified by parameters. N must be a positive integer.
The Noop none processing server returns a positive response without any operation.
------------------------------------------
Quit none update exit
Author: Chen junqing
Reprinted: chinacnet
More articles about "Use PHP to collect POP3 mails (1)"
Love J2EE follow Java Michael Jackson video station JSON online tools
Http://biancheng.dnbcw.info/php/324421.html pageno: 14