Are mime tired of sending tedious text notices and letters to your friends and clients? Have you ever considered sending attachments or embedding HTML in your mail
the answer is mime. The next few pages explain the basics of MIME, create MIME-compliant information, and then use a PHP
to work
class ends, this class implements sending compliant MIME messages. Note that references to call scripts, callers, and so on indicate the use of the
of the class that will be developed
scripts, client programs,/mua, and so on, represent mail-reading client programs or messages using an agent.
Some MIME basics
MIME represents the Multipurpose Internet Mail Expansion protocol. MIME expands the basic text-oriented Internet mail system so that it can be
The
message contains binary attachments.
MIME exploits The fact that RFC 822 makes a bit of a limit on the content of the message body: The only limitation is that you can only use simple
ASCII text. As a result, MIME information consists of normal Internet text messages, and text messages have special RFC-compliant
822 Information
header and formatted message body (with ASCII
A subset of
to represent the attachment). These MIME headers give a special
that represents an attachment in a message.
The
method.
Analysis of
MIME information
an ordinary text message contains a header section (To:from:
Subject: Et cetera) and a body part (Hello Mr.,
, etc.). In a MIME-compliant message, it is not surprising that each part of the message is called a MIME segment,
before each paragraph.
with a special head. MIME messages are only an extension based on RFC 822 messages. However, it has its own set of RFC specifications.
header Field
The MIME headers are roughly divided into MIME headers and MIME segment headers, depending on where they are in the mail package. (Translator: MIME message header refers to the entire message
headers, while the MIME segment header is only the header of each MIME segment. )
MIME headers are:
mime-version:
This header provides the version number of the MIME used. This value is customarily 1.0.
Content-type:
it defines the type of data so that data can be properly processed. Valid types are: Text,image,audio,video,
Applications,multipart and message. Note that any binary attachment should be called application/octet-
Stream. Some use cases for this head are: image/jpg, application/mswork,multipart/mixed, this is just a few
part.
content-transfer-encoding:
This is the most important of all headers, because it illustrates how the data is encoded, and the customer/mua
will use it to solve the attachment
code. For each attachment, you can use a 7bit,8bit,binary, Quoted-printable,base64, and a compilation in custom
code Way. 7bit encoding is a common encoding used on the US ASCII character set, which is to keep it intact. 8bit
and
binary encoding is generally not used. For human-readable standard text, if the transmission is to be protected by a gateway that has an effect on the format,
can use quoted printable. Base64 is a common method that provides a
when it is necessary to decide which encoding method to use
a brain-free choice; it is usually used in binary, not text data. Note that any non-7bit
Data must be in a pattern
encoding so that it can be passed through an Internet Mail gateway!
Content-id:
if Content-type is Message/external-body or multipart/alternative, this head is useful. It is beyond the scope of this article.
content-description:
This is an optional head. It is a free text description of the content of any information section. Description must use US-ASCII code.
content-disposition:
a pilot header that is used to provide tips to client/mua to determine whether to display attachments within a row or as a separate attachment.
The
MIME segment header (the header that appears in the actual MIME attachment section) can have any of the above header fields in addition to the mime-version header. If a MIME header is part of an information block, it acts on the entire body of information. For example, if content-transfer-encoding is displayed in the header of the information (the entire message), it applies to the entire body of information, but if it is displayed in a MIME segment, it is "only" used in that segment.
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.