Re: transfer encoding in header fields

Mark Overmeer <[email protected]> Thu, 7 Jul 2005 14:57:35 +0200
Newsgroups gmane.comp.lang.perl.modules.mail-box
Organization MARKOV Solutions
Message-ID <[email protected]>
* Daniel Carvalho ([email protected]) [050707 14:12]:
> i'm trying a very basic program to read messages from mozilla mail folders.
> 
> The methods body(), subjec(), to(), from() etc don't decode the data. It
> comes in quoted-printable or other Content-transfer-encoding.
> 
> To get the decoded body, i can call decoded(). And how about the headers
> fields - to, subject etc? Shouldn't MailBox deal with that transparently?
> 
> This is an example address i get when calling from():
> "=?iso-8859-1?q?Maria=20Ba?= <[email protected]>"

For decoding headers you have to use study() in one of its forms
  my $cc = $msg->study('cc');              #  ==
  my $cc = $msg->get('cc')->study;         #  ==
  my $cc = $msg->head->study('cc');        #  ==
  my $cc = $msg->head->get('cc')->study;

It returns a Mail::Message::Field::Full object, which is smart.
-- 
               MarkOv

------------------------------------------------------------------------
drs Mark A.C.J. Overmeer                                MARKOV Solutions
       [email protected]                          [email protected]
http://Mark.Overmeer.net                   http://solutions.overmeer.net