当前位置:网站首页>[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
边栏推荐
- 50亿,福建又诞生一只母基金
- CVPR 2022 - learning non target knowledge for semantic segmentation of small samples
- Golang client server login
- String type, constant type and container type of go language
- 能同时做三个分割任务的模型,性能和效率优于MaskFormer!Meta&UIUC提出通用分割模型,性能优于任务特定模型!开源!...
- 面试唯品会实习测试岗、抖音实习测试岗【真实投稿】
- 脑洞从何而来?加州大学最新研究:有创造力的人神经连接会「抄近道」
- 虚拟数字人里的生意经
- Save the memory of the model! Meta & UC Berkeley proposed memvit. The modeling time support is 30 times longer than the existing model, and the calculation amount is only increased by 4.5%
- 国内的软件测试会受到偏见吗
猜你喜欢
SD_ DATA_ RECEIVE_ SHIFT_ REGISTER
Short selling, overprinting and stock keeping, Oriental selection actually sold 2.66 million books in Tiktok in one month
Five network IO models
Tsinghua, Cambridge and UIC jointly launched the first Chinese fact verification data set: evidence-based, covering many fields such as medical society
A hodgepodge of ICER knowledge points (attached with a large number of topics, which are constantly being updated)
企业展厅设计中常用的三种多媒体技术形式
Differences between rip and OSPF and configuration commands
[Tawang methodology] Tawang 3W consumption strategy - U & a research method
Basic operation of chain binary tree (implemented in C language)
如何给“不卖笔”的晨光估值?
随机推荐
将模型的记忆保存下来!Meta&UC Berkeley提出MeMViT,建模时间支持比现有模型长30倍,计算量仅增加4.5%...
3.关于cookie
The moveposition function of rigidbody2d of unity2d solves the problem of people or screen jitter when moving
Hutool - lightweight DB operation solution
Micro service remote debug, nocalhost + rainbow micro service development second bullet
The live broadcast reservation channel is open! Unlock the secret of fast launching of audio and video applications
RIP和OSPF的区别和配置命令
Golang client server login
静态路由配置
Draw squares with Obama (Lua)
Flipping Game(枚举)
手把手教姐姐写消息队列
GSAP animation library
PTA 1101 B是A的多少倍
二叉树的基本概念和性质
博睿数据入选《2022爱分析 · IT运维厂商全景报告》
Kubernetes DevOps CD工具对比选型
单臂路由和三层交换的简单配置
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
RISCV64