Use PHP to decode POP3 emails (1)

Source: Internet
Author: User
Tags base64 microsoft outlook
Get a preliminary understanding of the source file of the email
(Author: Chen Junqing October 24, 2000)
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. We have already introduced you to receiving emails. Now let's introduce you to the decoding department in this article.
In the previous article, we have completed an instance that uses PHP to receive emails through POP3. However, when using this class, I believe you have seen it, A lot of emails are garbled and cannot be understood! Yes. Most emails have been encoded. A decoding process is required to convert them into texts, images, or other attachments that we are used.
SOURCE file of the email
First, let's look at the source file of a simple email: (in Foxmail, select the email and click "View source file" to see such content)
From: <boss_ch@netease.com>
To: <boss_ch@china.com>
Subject: =? Gb2312? B? XOO6w6Oh? =
Date: Sun, 8 Oct 2000 20:28:45 + 0800
MIME-type: 1.0
Content-Type: multipart/alternative;
Boundary = "---- = _ nextpart_000_0007_01c01_6.5b1e9510"
X-Priority: 3
X-MSMail-Priority: Normal
X-Mailer: Microsoft Outlook Express 5.00.2919.6700
X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700
This is a multi-part message in MIME format.
------ = _ Nextpart_000_0007_01c01_6.5b1e9510
Content-Type: text/plain;
Charset = "gb2312"
Content-Transfer-Encoding: base64
W7vT0MLSwuuwyaO/DQo =
------ = _ Nextpart_000_0007_01c01_6.5b1e9510
Content-Type: text/html;
Charset = "gb2312"
Content-Transfer-Encoding: base64
Bytes
Bytes
MjMxMiIgaHR0cC1lcXVpdj1Db250ZW50LVR5cGU + dqo8tuvuqsbjb250zw50psjnu0huuwgns4w
Mc4yotiwljaiig5hbwu9r0vorvjbve9sp1_kpfnuwuxfp1_vu1rzteu + DQo8L0hFQUQ + DQo8Qk9E
WSBiZ0NvbG9yPSNmZmZmZmY + dqo8relwpjxgt05uihnpemu9mj7du9pqwtlc67djo788l0zptscsi +

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.