[Mailmunge] Fetching all Headers.

list at ptld.com list at ptld.com
Mon Nov 11 20:35:55 EST 2024


> What is the best way to fetch all headers with either MIME::Head, 
> Mail::Header, or other?
> Is there a cleaner way to accomplish that or is that it?


I resolved unfolding the headers so this approach works, but id still prefer 
a cleaner approach if possible.

   my $all_headers = $ctx->mime_entity->head->as_string;
   $all_headers =~ s/\n\s+/ /g;
   my @full_headers = split(/\n/, $all_headers);
   foreach (@full_headers) {$_ =~ s/\r//g};
   my %headers;
   foreach (@full_headers) {
     my ($k, $v) = split(/\s*:\s*/, $_, 2);
     $headers{$k} = $v;
   }




More information about the Mailmunge mailing list