MIME Little Knowledge

Source: Internet
Author: User
Tags header mail client
MIME users can use MIME to set up the server to transfer multimedia such as sound and animation information, which may be done through CGI scripts. In the following article, you can learn about mime and about the use of MIME on the network.





MIME is a technical specification, it was used for e-mail, and now it can be used in browsers, to send information that can be identified by browsers, and the knowledge of mime is very difficult to understand, some basic computer concepts can be understood, but if you want to further use, you must pay attention to the content. In fact, we have access to mime when we surf the internet, but browsers and servers are implemented at the bottom.





MIME is sometimes incorrectly understood as a multimedia Internet Mail Extension (multimedia), which is an error, but MIME is often used on the web for multimedia applications, So it's important to note that this is a multimedia mail extension, and it should actually be called a Multipurpose Internet Mail Extension (multipurpose), because sometimes there is no text element in the content.





MIME is a huge extension of the messaging system, because before MIME appears, the contents of a letter must be translated into ASCII code or converted into a code standard that can be transmitted, and the receiver must be decoded to obtain sound and picture information if it is to include sound and animation. MIME provides a way to attach a number of different encoding files to a message. This is very different from the original mail. Now MIME has become a part of the HTTP protocol standard.





MIME is the primary method by which the server notifies the client of the type of transfer file, and the client browser also tells the server its parameters by mime. On the Web, if you receive a file that does not have a MIME header, the default is HTML format. But this is also bad, because when the MIME header is Text/plain, the browser will directly display without caring about its font, color and other parameters, so that the display of content is not very good-looking ah.





What the MIME header looks like depends on whether it is used in e-mail or in a browser, and the content may be different. For the message headers, the version number, the content type declaration, the encoding method, the content description is essential. This is for the format in the header, and we will focus on the transfer of MIME headers in HTTP, where the MIME headers are simpler.





The following example is a standard MIME header for a message:





mime-version:1.0//Version number: 1.0





content-type:multipart/mixed; Boundary= "IMA. boundary.750407228 "//content type is a variety of





--ima. boundary.750407228





Content-type:text/plain; CHARSET=US-ASCII//Content type: text, character is ASCII





content-transfer-encoding:7bit//Coding mode: 7-bit





Content-description:cc:mail Note Part





when used in a browser, the user does not need to know so much information, so the MIME header is relatively simple. When you visit a Web page, the browser and the server generate a session, as part of the request, the browser sends a description of the MIME type that it can understand, which tells the server, in addition to the Web page can also support what the server generally does not make changes to this information.




The
server informs the client what the browser content is by sending a MIME header to the clients, let's look at the following header:





content-type:text/html





in implementation, be sure to pay attention to the MIME header to follow a blank line, or the head will be ignored by the browser, the head will be as text display. When the server transmits GIF images, the headers are as follows:





 





Content-type:image/gif





content-transfer-encoding:binary





 





the usual MIME content type does not work, the browser can identify the type of content itself, but if you use a different type, the problem is large, if you use the Text/postscript, the browser will display the download window, or just show this thing, That would be a difficult thing to do. Here's a look at the standard MIME type.





Text. Text, which is used to describe different types of text, including the usual text, PostScript, and HTML, although HTML is not a possible subtype.





Multipart. Multiple types, indicating that this information includes more than one type of information.





message. Used to mark different types of messages.





application. The type of application.





Image. An image used to indicate a graphic file.





Audio. Sound used to indicate a sound file.





video. An image that is used to indicate an animated file.





each MIME type has a different subtype, in fact, you cannot use the type alone without the subtype, with one exception, which is the "Telnet" type. The IANA provides 45 types/subtypes for support. Of course, the standard is open, allowing users to customize their own types, user-defined types should be "X" to start with the distinction. When adding a new type, be sure to try to use the existing type to achieve your goal. If you do not want to add a new type, make sure that the server side supports this type, and that the client can recognize the new type through some applications, such as Plug-ins. If your site has a wide range of visitors, do not easily use the new type, either by using an existing type or by making a registration request to the IANA.











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.