当前位置:网站首页>[mime notes]
[mime notes]
2022-07-07 19:08:00 【Full stack programmer webmaster】
Hello everyone , I meet you again , I'm the king of the whole stack .
I am interested in some technical details of the Internet recently , I plan to take a series of notes .
=================
MIME note
1.
MIME The full name is ”Multipurpose Internet Mail Extensions”, The Chinese translation is ” Multi purpose Internet mail extension ”, It refers to a series of e-mail technical specifications , It mainly includes RFC 2045、RFC 2046、RFC 2047、RFC 4288、RFC 4289 and RFC 2077.
seeing the name of a thing one thinks of its function ,MIME It's an extension of traditional email , Now it has become the de facto standard for email .
2.
Traditional email is 1982 Set the technical specifications in , File is RFC 822.
An important feature of it , It stipulates that email can only be used ASCII character . This leads to three results :1) Non English characters cannot be used in email ;2) Binary files cannot be inserted into email ( Such as images );3) Email cannot have attachments .
This is actually unacceptable , So here we are 1992 year , Engineers decided to expand the technical specification of e-mail , Propose a series of supplementary specifications , This is it. MIME The origin of .
3.
Here is a traditional email .
From: “Tommy Lee” <[email protected]> To: “Jack Zhang” <[email protected]> Subject: Test Date: Wed, 17 May 2000 19:08:29 -0400 Message-ID: <[email protected]> Hello World.
As can be seen from the above , The address of the sender of this letter is [email protected], The address of the addressee is [email protected], The subject of the email is Test, The sending time is 2000 year 5 month 17 Japan , The content of the email is ”Hello World.”.
On the structure , The letter is divided into three parts : The first is the letter header , And then there's a blank line , Finally, the content of the letter . The recipient's client software will only display the last part , To view Quanxin , You have to use ” View the original message ” function .
4.
MIME Extensions to traditional email , It shows that it adds several sentences in the head of the letter , There are mainly three .
The first is :
MIME-Version: 1.0
This statement is necessary , and 1.0 The value of this version is unchanged , Even if MIME It has been upgraded several times .
With this sentence , The receiver knows that this letter is used MIME standard .
5.
The second sentence is :
Content-Type: text/plain; charset=”ISO-8859-1″
This line is extremely important , It indicates the type of information transmitted and the coding used .
Content-Type Indicate the type of information , The default value is ” text/plain”. It contains the main types (primary type) And the secondary type (subtype) Two parts , Use... Between the two ”/” Division . The main types are 9 Kind of , Namely application、audio、example、image、message、model、multipart、text、video.
There are many secondary types under each primary type , Common are :
text/plain: Pure text , File extension .txt text/html:HTML Text , File extension .htm and .html image/jpeg:jpeg Format picture , File extension .jpg image/gif:GIF Format picture , File extension .gif audio/x-wave:WAVE Format audio , File extension .wav audio/mpeg:MP3 Format audio , File extension .mp3 video/mpeg:MPEG Video format , File extension .mpg application/zip:PK-ZIP Format of compressed files , File extension .zip
The details of the Content-Type list , You can check here and here .
If the main type of information is ”text”, Then you must also specify the encoding type ”charset”, The default value is ASCII, Other possible values are ”ISO-8859-1″、”UTF-8″、”GB2312″ wait .
Whole Content-Type This business , Not only in email , Later, it was transplanted to HTTP Agreement , So now as long as it is spread online HTTP Information , All carry Content-Type head , To indicate the type of information .
6.
I've said that before , The traditional format of e-mail does not support non ASCII Coding and binary data . therefore MIME The third sentence is prescribed :
Content-transfer-encoding: base64
This statement indicates the way of encoding conversion .Content-transfer-encoding The value is 5 Kind of —-“7bit”、”8bit”、”binary”、”quoted-printable” and ”base64”—- among ”7bit” Is the default value , That is, it doesn't need to be transformed ASCII character . The really common ones are ”quoted-printable” and ”base64″ Two kinds of , Their detailed usage , I will introduce it in detail in tomorrow's notes .
7.
The following is the source code of an email I received :
Date: Wed, 18 Jun 2008 18:07:51 +0800 (CST) From: xxx <[email protected]> To: [email protected] Message-ID: <[email protected]m> Subject: =?gbk?B?xOO6ww==?= MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="—-=_Part_287491_22998031.1213783671982" ——=_Part_287491_22998031.1213783671982 Content-Type: text/plain; charset=gbk Content-Transfer-Encoding: base64 IAq4+b7dsr+209PQudi55raoo6yyu7XD1Nq12Le9yM66zs341b7Jz7nSz+DTprXEtqvO96Osx+vE 49TaxOO1xLKpv83W0AogIArW0Ln6yr2x6tPvIC0gyO7Su7fltcTN+MLnyNXWvgoKtcS12jEy1cXN vMasyb6z/aOst/HU8s7Sw8fXt76/xOO1xM/gudjU8MjOoaPQu9C7us/X96OhtMvNvMas1Nq4vbz+ wO/D5g== ——=_Part_287491_22998031.1213783671982 Content-Type: text/html; charset=gbk Content-Transfer-Encoding: quoted-printable <DIV>&nbsp;</DIV> <DIV>=B8=F9=BE=DD=B2=BF=B6=D3=D3=D0=B9=D8=B9=E6=B6=A8=A3=AC=B2=BB=B5=C3=D4= =DA=B5=D8=B7=BD=C8=CE=BA=CE=CD=F8=D5=BE=C9=CF=B9=D2=CF=E0=D3=A6=B5=C4=B6=AB= =CE=F7=A3=AC=C7=EB=C4=E3=D4=DA=C4=E3=B5=C4=B2=A9=BF=CD=D6=D0</DIV> <DIV>&nbsp; ……
You can see this letter MIME The sentence is :
MIME-Version: 1.0 Content-Type: multipart/alternative; boundary=”—-=_Part_287491_22998031.1213783671982″
“Content-Type: multipart/alternative;” Indicate the content of this letter , It's plain text and HTML Text blending . The other two possible values are multipart/mixed and multipart/related, respectively ” There are binary contents in the contents of the letter ” and ” The letter is attached ”.
“boundary=”—-=_Part_287491_22998031.1213783671982″ “ The dividing line indicating the contents of different letters is ”—-=_Part_287491_22998031.1213783671982″, It's usually a very long random string .
There are two sub headers in the content of the letter :
Content-Type: text/plain; charset=gbk Content-Transfer-Encoding: base64
and
Content-Type: text/html; charset=gbk Content-Transfer-Encoding: quoted-printable
They show that , The first part is gbk Encoded plain text , The encoding conversion format is base64. The second part is gbk Coded HTML Text , The encoding conversion format is quoted-printable.
( End )
Publisher : Full stack programmer stack length , Reprint please indicate the source :https://javaforall.cn/120844.html Link to the original text :https://javaforall.cn
边栏推荐
- Antisamy: a solution against XSS attack tutorial
- How much does it cost to develop a small program mall?
- RIP和OSPF的区别和配置命令
- 国内首次!这家中国企业的语言AI实力被公认全球No.2!仅次于谷歌
- 【MIME笔记】
- RISCV64
- Recommend free online SMS receiving platform in 2022 (domestic and foreign)
- How many times is PTA 1101 B than a
- Thread pool and singleton mode and file operation
- CVPR 2022丨学习用于小样本语义分割的非目标知识
猜你喜欢

Short selling, overprinting and stock keeping, Oriental selection actually sold 2.66 million books in Tiktok in one month

静态路由配置

Standard ACL and extended ACL
![Learn open62541 -- [67] add custom enum and display name](/img/98/e5e25af90b3f98c2be11d7d21e5ea6.png)
Learn open62541 -- [67] add custom enum and display name

10 schemes to ensure interface data security

数据验证框架 Apache BVal 再使用

The live broadcast reservation channel is open! Unlock the secret of fast launching of audio and video applications

SD_ DATA_ RECEIVE_ SHIFT_ REGISTER

GSAP animation library

我感觉被骗了,微信内测 “大小号” 功能,同一手机号可注册两个微信
随机推荐
"Decryption" Huawei machine vision Corps: Huawei is moving up and the industry is moving forward
PTA 1102 教超冠军卷
POJ 1182 :食物链(并查集)[通俗易懂]
A hodgepodge of ICER knowledge points (attached with a large number of topics, which are constantly being updated)
Cadre de validation des données Apache bval réutilisé
[information security laws and regulations] review
NAT地址转换
I feel cheated. Wechat tests the function of "size number" internally, and two wechat can be registered with the same mobile number
Do you know all four common cache modes?
[Blue Bridge Cup training 100 questions] sort scratch from small to large. Blue Bridge Cup scratch competition special prediction programming question centralized training simulation exercise question
伺服力矩控制模式下的力矩目标值(fTorque)计算
Reject policy of thread pool
Standard ACL and extended ACL
How much does it cost to develop a small program mall?
PTA 1102 teaching Super Champion volume
testing and SQA_动态白盒測试[通俗易懂]
How to implement safety practice in software development stage
Cloud security daily 220707: Cisco Expressway series and telepresence video communication server have found remote attack vulnerabilities and need to be upgraded as soon as possible
企业展厅设计中常用的三种多媒体技术形式
Datasimba launched wechat applet, and datanuza accepted the test of the whole scene| StartDT Hackathon