tmail

How to decode an RFC 2047 encoded email header in Ruby?

白昼怎懂夜的黑 提交于 2019-12-20 02:12:22
问题 I have the following header: From: =?iso-8859-1?Q?Marta_Falc=E3o?= <marta.falcao@example.com.br> I can easily split out the stuff before the < , which leaves me with "=?iso-8859-1?Q?Marta_Falc=E3o?=" What can I use to turn this into "Marta Falcão" ? 回答1: Using the newer Mail gem: Mail::Encodings.value_decode(str) or Mail::Encodings.unquote_and_convert_to(str, to_encoding) 回答2: Thanks to Roland Illig for his comment, which led me to two options: install rfc2047-ruby and call Rfc2047.decode

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