本文介绍了Ruby电子邮件编码和可引用的可打印内容的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有直接的方法来教导TMail使身体使用quoted-printable进行编码?我只看到那些解码内容的方法,而不是创建它。

Is there a straightforward way to coach TMail to make the body encoded with "quoted-printable"? I only see methods in there for decoding content like that, not creating it.

推荐答案

您是否使用 TMail ,或者您是否使用 ActionMailer ?它看起来像 TMail 本身不具有编码为 quoted-printable 的能力。但是,它看起来像 ActionMailer 确实有这种能力。

Are you just using TMail, or are you using it with ActionMailer? It looks like TMail itself does not have the ability to encode as quoted-printable. However, it looks like ActionMailer does have this ability.

它看起来像 TMail 允许您设置 Content-Transfer-Encoding 标题如下: -

It looks like TMail allows you to set the Content-Transfer-Encoding header as follows :-

mail = TMail::Mail.new
mail.transfer_encoding = "quoted-printable"

但是看起来这样做并不会对身体进行编码。

But it looks like this doesn't actually encode the body.

您可以看到 ActionMailer 设置此标题方法将身体编码为 quoted-printable 。也许你可以利用这个...?

ActionMailer has the ActionMailer::Quoting::quoted_printable method to encode the body as quoted-printable. Maybe you can make use of this...?

这篇关于Ruby电子邮件编码和可引用的可打印内容的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-11 04:28