[Mailmunge] Fetching all Headers.
list at ptld.com
list at ptld.com
Mon Nov 11 19:40:36 EST 2024
What is the best way to fetch all headers with either MIME::Head,
Mail::Header, or other?
Id prefer a type of (pseudo code):
my %headers = $ctx->mime_entity->head->get_all("*");
That creates a $headers{$key} = $value.
The best way i found so far is:
my $all_headers = $ctx->mime_entity->head->as_string;
my @full_headers = split(/\n/, $all_headers);
chomp @full_headers;
my %headers;
foreach (@full_headers) {
my ($k, $v) = split(/\s*:\s*/, $_, 2);
$headers{$k} = $v;
}
Is there a cleaner way to accomplish that or is that it?
More information about the Mailmunge
mailing list