The*_*ndr 7 php email hash mime boundary
我正在使用PHP mail()函数发送带附件的邮件.因此,PHP源内容是一个边界,用于定义附件的开始和结束位置.
所以问题是:是否有任何用于创建此MIME边界的标尺(例如,只允许使用字母和numbres)我仍然知道这个问题 - > 什么规则适用于MIME边界? 是否有必要从HASH创建边界?因为以下也有效:
$headers .= "Content-Type: multipart/related; boundary=\"abc\"";
[...]
$msg .="--abc\n";
[...]
$msg .= "--abc--\n\n";
Run Code Online (Sandbox Code Playgroud)
有一个原因,为什么MIME边界应该是唯一值?
..i没有在互联网上找到任何信息.
谢谢!
没有什么规定边界标记必须是哈希值,但它们必须是唯一的。想想如果您插入的实际电子邮件文本自然地--abc--
在某处包含这些单词,会发生什么。
您的电子邮件将如下所示:
--abc-- <--actual boundary
This is my email. There are many like it, but this one is mine.
Now for some reason I'm going to put in a line that shouldn't be there
--abc-- <--part of the email
There it was. Did you see it? No, you didn't, because the mail client saw a boundary
line and sliced it out. Because of this extra boundary, now the email has 2 sections,
instead of 1.
--abc-- <--actual boundary
Run Code Online (Sandbox Code Playgroud)
那么...邮件客户端如何知道电子邮件的一部分以及“开销”是什么?这就是您使用独特边界的原因。
哈希是最简单的方法。在极端情况下,电子邮件文本不太可能在可以被视为边界标记的确切位置包含自己的哈希值。