Transferred from Wiki
Multi-purpose Internet Mail Extension (MIME,Multipurpose Internet Mail Extensions) Is an internet standard that extends the email standard to support mail messages in multiple formats such as non-ASCII characters and binary format attachments. This standard is defined in RFC 2045, RFC 2046, RFC 2047, RFC 2048, RFC 2049, and so on. RFC 822, which is transformed from RFC 2822, stipulates that the email standard does not allow seven characters other than the ASCII character set in the email message. For this reason, non-English-character messages and binary files, images, sounds, and other non-text messages cannot be transmitted in emails. Mime specifies a symbolic method used to represent a variety of data types. In addition, the mime framework is also used in the HTTP protocol used in the World Wide Web.
Content-Type. This header field is used to specify the message type. Generally.
Content-Type: [type]/[subtype]; Parameter
Type has the following format.
- Text: indicates the standardized representation of text information. Text messages can be in multiple character sets or formats;
- Multipart: connects multiple parts of the message body to form a message. These parts can be different types of data;
- Application: used to transmit applicationsProgramData or binary data;
- Message: Used to package an e-mail message;
- Image: used to transmit static image data;
- Audio: used to transmit audio or audio data;
- Video: used to transmit dynamic image data. It can be a video data format edited together with audio.
Subtype is used to specify the type details. The set of Content-Type/subtype pairs and related parameters will increase over time. To ensure that these values are developed in an orderly and open state, mime uses Internet Assigned Numbers Authority (IANA) as the central registration mechanism to manage these values. Common subtype values are as follows:
- Text/plain (plain text)
- Text/html (HTML document)
- Application/XHTML + XML (XHTML document)
- Image/GIF (GIF image)
- Image/JPEG (JPEG image) [image/pjpeg in PHP]
- Image/PNG (PNG Image) [image/X-PNG in PHP]
- Video/MPEG (mPEG animation)
- Application/octet-stream (any binary data)
- Application/pdf (PDF)
- Application/MSWord (Microsoft Word file)
- Message/rfc822 (RFC 822 format)
- Multipart/alternative (HTML form and plain text form of HTML mail, the same content is expressed in different forms)
- Application/X-WWW-form-urlencoded (Form submitted using the http post method)
- Multipart/form-data (same as above, but mainly used when the form is submitted along with file upload)
In addition, subtypes that are not accepted as formal data types can be independent names starting with X-(for example, application/X-gzip ). The inherent name of VND-start can also be used (for example, application/vnd. MS-Excel ).
parameter can be used to specify additional information. In more cases, it is used to specify charset parameters for text encoding methods such as text/plain and text/htm. Mime defines the default subtype Based on the type. When the client cannot determine the subtype of the message, the message is treated as the default subtype for processing. Text is text/plain by default, application is application/octet-stream by default, and multipart is considered multipart/mixed by default.