]> Sergey Matveev's repositories - public-inbox.git/commitdiff
learn: support multiple To/Cc headers
authorEric Wong <e@80x24.org>
Mon, 28 Oct 2019 10:45:15 +0000 (10:45 +0000)
committerEric Wong <e@80x24.org>
Wed, 30 Oct 2019 08:48:06 +0000 (08:48 +0000)
It's possible to specify these headers multiple times, and
PublicInbox::MDA->precheck takes that into account, so
-learn should, too.

script/public-inbox-learn

index c4c4d4b95882cd45d36896519ad51381718d2f11..8ff1652b07234709fd3e661f0a945c4b6b88d512 100755 (executable)
@@ -42,9 +42,11 @@ my $mime = PublicInbox::MIME->new(eval {
 # get all recipients
 my %dests;
 foreach my $h (qw(Cc To)) {
-       my $val = $mime->header($h) or next;
-       foreach my $email (PublicInbox::Address::emails($val)) {
-               $dests{lc($email)} = 1;
+       my @val = $mime->header($h) or next;
+       for (@val) {
+               foreach my $email (PublicInbox::Address::emails($_)) {
+                       $dests{lc($email)} = 1;
+               }
        }
 }