当您编写 MIME 时,您会用一定的边界分隔消息的不同块。由于某种原因,我未能找到任何解释此边界的文档,但以下是我从示例中收集到的内容:
边界可以是任何字母和数字字符串,即。 e. “d29a0c638b540b23e9a29a3a9aebc900aeeb6a82”。
生成边界没有规则,您只需 md5sum 您所爱的人的名字,就这样,您就得到了边界。
-
如果您通过 HTTP 发送 MIME,则必须添加一个标头“Content-Type”来指定您的行为以及您的边界,标头的内容可能如下所示:
多部分/表单数据;边界=d29a0c638b540b23e9a29a3a9aebc900aeeb6a82
-
在邮件正文中,边界前面应带有“--”,例如:
--d29a0c638b540b23e9a29a3a9aebc900aeeb6a82
但遵循这些规则(并且this https://stackoverflow.com/questions/2627949/upload-file-with-post-method-on-qt4/2634842#2634842有用的答案)我无法生成服务器会接受的 POST 查询。我错过了什么吗?我是不是搞错了什么?
The 边界语法 https://www.rfc-editor.org/rfc/rfc2046#section-5.1.1 is:
boundary := 0*69<bchars> bcharsnospace
bchars := bcharsnospace / " "
bcharsnospace := DIGIT / ALPHA / "'" / "(" / ")" /
"+" / "_" / "," / "-" / "." /
"/" / ":" / "=" / "?"
And the 多部分实体的主体 https://www.rfc-editor.org/rfc/rfc2046#section-5.1.1具有语法(仅重要部分):
multipart-body := [preamble CRLF]
dash-boundary transport-padding CRLF
body-part *encapsulation
close-delimiter transport-padding
[CRLF epilogue]
dash-boundary := "--" boundary
encapsulation := delimiter transport-padding
CRLF body-part
delimiter := CRLF dash-boundary
close-delimiter := delimiter "--"
前面的--
对于消息和尾随中使用的每个边界都是强制性的--
对于关闭边界是强制性的(结束分隔符)。所以一个由三个身体部分组成的多部分身体boundary
as boundary可以看起来像这样:
--boundary
1. body-part
--boundary
2. body-part
--boundary
3. body-part
--boundary--
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)