Hello list,
What is the best way to get the headers of an email into a hash and also the text part
of the body into an array or variable?
Here's what I have so far ::
Assuming I have the entire email form stdin in the var $entmsg.
# First get body
use Mail::Internet;
my $mail = new Mail::Internet; # how do I get $entmsg into here, cpan page isn't real
helpful
$mail->tidy_body(); # is this the right order/syntax for these
my @body = $mail->body();
# next get header
use Mail::Header;
my $head = new Mail::Header \$entmsg, Modify => 0;
my %header_info = $head->header_hashref();
my $to = $header_info{'To'};
my $fr = $header_info{'From'};
my $su = $header_info{'Subject'};
my $mi = $header_info{'Message-ID'};
I know that Mail::Internet has a head()function that actaully uses a Mail::Header
object on 'new' but I'm not sure the sytax that should have.
Does anybody have any ideas how to combine those two sections above so I can use one
module to get the headers in a hash and the text part of the body? Something like this
perhaps :
use Mail::Internet;
my $mail = new Mail::Internet; # what params/syntax ???
my @body = $mail->body(); # or does my @body = $mail->tidy_body(); return the same
thing just tidied up ?
my %header_info = $mail->head(); # used likek thus - $header_info{'To'}; ,
$header_info{'Subject'};
Thanks
Dan
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]