2 回答

TA贡献1752条经验 获得超4个赞
如果不了解你的期望,就很难看出这里出了什么问题。但是对于每个依恋肯定是相当可疑的。你基本上是在说“这里有两个等同的部分;使用你喜欢的任何一个“,但没有任何标题(隐含的)似乎无法提供与显式文本部分相同的内容或最终用户体验。multipart/alternativetext/plain
显而易见且直接的问题是,在最后两个部分之前,您没有 MIME 边界。您需要在标头之前具有紧挨着的 MIME 边界,如下所示:multipart/alternative
...
<h1>Your random text is: </h1><b>JU0NZU4ODAX</b>
--WMaSWQ0Q205bd0Ly000W5p00N5ohAMoUpXu050nC0d0a0r0y050B0O0UkN0D0ARY--
--VH5S0k0C2sKbOiiC0CQW0H0gdwo0A00wLHuY0Knk0dzaTr5y55VB0O5UqN0D5ARY
Content-Type: multipart/alternative; boundary="hcx0dnS50VSCeMb5mSyM05W00yQT0odL7050u0XMn5UdUa0rdy050B0OgUjNDARY"
--hcx0dnS50VSCeMb5mSyM05W00yQT0odL7050u0XMn5UdUa0rdy050B0OgUjNDARY
A file containing some information
...
但是我猜你应该只是删除最后两个结构中的图层,并最终得到一个包含一个(带有和渲染的顶层,或者可能只是省略无用的部分,这无论如何都会让每个人都很烦恼,如果确实是你可以提供的全部,那么只需放置一个部分而不是结构,然后是两个部分。multipart/alternativemultipart/mixedmultipart/alternativetext/plaintext/htmltext/plaintext/htmlmultipart/alternativetext/plainContent-Disposition: attachment
顺便说一句,不要在示例中使用您不知道他们属于谁的地址(更不用说您知道属于无辜第三方的地址了)。
From: FooBar
To: some@example.com
Subject: Random Text
MIME-Version: 1.0
Content-Type: multipart/mixed; boundary="VH5S0k0C2sKbOiiC0CQW0H0gdwo0A00wLHuY0Knk0dzaTr5y55VB0O5UqN0D5ARY"
--VH5S0k0C2sKbOiiC0CQW0H0gdwo0A00wLHuY0Knk0dzaTr5y55VB0O5UqN0D5ARY
Content-Type: multipart/alternative; boundary="WMaSWQ0Q205bd0Ly000W5p00N5ohAMoUpXu050nC0d0a0r0y050B0O0UkN0D0ARY"
--WMaSWQ0Q205bd0Ly000W5p00N5ohAMoUpXu050nC0d0a0r0y050B0O0UkN0D0ARY
We thought it would be helpful to display an annoying suggestion
to look at this in an HTML viewer instead of provide you with
the information which is only visible in the HTML part.
Nyah, nyah.
--WMaSWQ0Q205bd0Ly000W5p00N5ohAMoUpXu050nC0d0a0r0y050B0O0UkN0D0ARY
Content-Type: text/html; charset="UTF-8"
Content-Description: (if you don't have a description, don't add this header)
Content-Disposition: inline
Content-Transfer-Encoding: 7bit
<h1>Your random text is: </h1><b>JU0NZU4ODAX</b>
--WMaSWQ0Q205bd0Ly000W5p00N5ohAMoUpXu050nC0d0a0r0y050B0O0UkN0D0ARY--
--VH5S0k0C2sKbOiiC0CQW0H0gdwo0A00wLHuY0Knk0dzaTr5y55VB0O5UqN0D5ARY
Content-Type: text/plain; charset="utf-8"
Content-Description: random-text.txt
Content-Disposition: attachment; filename="random-text.txt";
Content-Transfer-Encoding: base64
Content-ID: <random-text.txt>
SlUwTlpVNE9EQVg=
--VH5S0k0C2sKbOiiC0CQW0H0gdwo0A00wLHuY0Knk0dzaTr5y55VB0O5UqN0D5ARY
Content-Type: text/plain; charset="utf-8"
Content-Description: no-matter.txt
Content-Disposition: attachment; filename="no-matter.txt";
Content-Transfer-Encoding: base64
Content-ID: <no-matter.txt>
w4kgQklSTCBNRVNNTw==
--VH5S0k0C2sKbOiiC0CQW0H0gdwo0A00wLHuY0Knk0dzaTr5y55VB0O5UqN0D5ARY--

TA贡献1805条经验 获得超9个赞
您可以尝试使用此 https://github.com/jordan-wright/email 生成具有相同内容和附件的.eml文件,然后将其与您的文件进行比较以找出差异。
- 2 回答
- 0 关注
- 116 浏览
添加回答
举报