Something like that: module TMail class Mail def qp_encode store 'Content-Transfer-Encoding', 'Quoted-Printable' self.body = [self.body].pack('M') end end def qp_decode if /quoted-printable/i =~ self.transfer_encoding('') store 'Content-Transfer-Encoding', '8bit' self.body = self.body.unpack('M') end end end end
LOL. Вчера ровно этим (decode only, QP+B64) и занимался: require 'tmail/mail' module TMail class Mail def decode case transfer_encoding when nil then return body when "base64" then return body.unpack('m*') when "quoted-printable" then return body.unpack('M*') else return body #raise "Unknown encoding: #{transfer_encoding}" end end #def save(file=nil, decode=true) # # filename can be set or taken from the mail itself # file = disposition_param('filename') unless file #end end end
Ну в общем новый TMail умеет и QP тоже.