Ruby email encoding and quoted-printable content

emailrubytmail

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.

Best Answer

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...?

Related Topic