The Mail::Header library apparently returns CC, never Cc.

This commit is contained in:
Bradley M. Kuhn 2023-06-03 10:14:40 -07:00
parent cdcf26f8fa
commit 347e0d3113

View file

@ -136,12 +136,13 @@ sub ProcessMailDir($$$) {
my $upiFull = NextUPI(); my $upiFull = NextUPI();
my $header = new Mail::Header($msgFH); my $header = new Mail::Header($msgFH);
my $fields = $header->header_hashref; my $fields = $header->header_hashref;
my %parsed = (FromName => '', ToName => '', FromAddr => "", ToAddr => "", CcName => '', CcAddr => '', 'Subject' => '', my %parsed = (FromName => '', ToName => '', FromAddr => "", ToAddr => "", CCName => '', CCAddr => '', 'Subject' => '',
Date => ''); Date => '');
foreach my $fieldName (qw/From To Cc Subject Date/) { use Data::Dumper;
foreach my $fieldName (qw/From To CC Subject Date/) {
foreach my $item (@{$fields->{$fieldName}}) { foreach my $item (@{$fields->{$fieldName}}) {
chomp $item; chomp $item;
if ($fieldName =~ /From|To|Cc/) { if ($fieldName =~ /From|To|CC/) {
my $addr = Email::Address::XS->parse($item); my $addr = Email::Address::XS->parse($item);
if ($addr->name ne "") { if ($addr->name ne "") {
$parsed{"${fieldName}Name"} .= "; " if $parsed{"${fieldName}Name"} !~ /^\s*$/; $parsed{"${fieldName}Name"} .= "; " if $parsed{"${fieldName}Name"} !~ /^\s*$/;