Ruby email encoding and quoted-printable content

情到浓时终转凉″ 提交于 2019-12-12 18:50:22

问题


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.


回答1:


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.

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.

You can see ActionMailer setting this header here. quoted-printable seems to be the default for ActionMailer.

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



来源:https://stackoverflow.com/questions/1034135/ruby-email-encoding-and-quoted-printable-content

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!