纯文本电子邮件和仅包含纯文本的多部分电子邮件之间有区别吗?

发布于 2024-09-03 20:23:18 字数 868 浏览 8 评论 0原文

我正在使用 Rails 发送电子邮件,并且只想发送纯文本电子邮件(没有相应的 HTML 部分)。

我注意到,如果我只有一个名为 email.text.plain.erb 的文件,它实际上会生成一封多部分电子邮件,其中一部分(纯文本部分)如下所示:

Content-Type: multipart/alternative; boundary=mimepart_4c04a2d34c4bb_690a4e56b0362

--mimepart_4c04a2d34c4bb_690a4e56b0362
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: Quoted-printable
Content-Disposition: inline

text of the email here...

--mimepart_4c04a2d34c4bb_690a4e56b0362--

但是如果我取出text.plain 部分并将其命名为 email.erb ActionMailer 会生成一封没有多部分的常规纯文本电子邮件,如下所示:

Content-Type: text/plain; charset=utf-8

text of the email here...

两者在大多数情况下都工作正常(所以这有点挑剔),但我想我的问题是第二个是否更正确。我的目标只是确保在各种设备和电子邮件客户端上尽可能高的送达率。

我读过,纯文本电子邮件的送达率比 html 略高,我很好奇加入这个多部分(即使它只包含纯文本部分)是否可能会甩掉一些较笨的电子邮件客户端。感谢您的帮助!

I'm using Rails to send emails and I just want to send a plain text email (there is no corresponding HTML part).

I've noticed that if I just have one file named email.text.plain.erb it actually generates a multipart email with one part (the plain text part) like this:

Content-Type: multipart/alternative; boundary=mimepart_4c04a2d34c4bb_690a4e56b0362

--mimepart_4c04a2d34c4bb_690a4e56b0362
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: Quoted-printable
Content-Disposition: inline

text of the email here...

--mimepart_4c04a2d34c4bb_690a4e56b0362--

But if I take out the text.plain part and name it email.erb ActionMailer generates a regular plain text email without multipart like this:

Content-Type: text/plain; charset=utf-8

text of the email here...

Both work fine most of the time (so this is kind of nitpicky), but I guess my question is whether the second one is more correct. My goal here is just to make sure deliverability is as high as possible across a wide variety of devices and email clients.

I've read that plain text emails can have slightly better deliverability rates than html and was just curious if throwing in this multipart (even if it only contained a plain text part) might throw off some of the dumber email clients. Thanks for your help!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

凌乱心跳 2024-09-10 20:23:18

这些天不太可能产生影响。过去,存在根本不支持多部分消息的电子邮件客户端,但现在它们都支持:即使只是剥离 HTML 并仅显示纯文本。

从节省几个字节的角度来看,发送纯文本是件好事,但我认为否则不会有什么坏处。

It's unlikely to have an affect these days. It used to be that there existed email clients that didn't support multi-part messages at all, but today they all do: even if it's just to strip off the HTML and display only the plain text.

It's good to just send the plain text from the point of view that you're saving a few bytes, but I don't imagine it would hurt otherwise.

夏了南城 2024-09-10 20:23:18

我会选择第二名。虽然现在大多数电子邮件软件都能很好地处理多部分消息,但将纯文本电子邮件包装成单独的部分却一无所获。

I'd go for number two. While most email software handle multipart messages just fine these days, you gain nothing by wrapping a plain text email into a separate part.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文