- my $from = $mime->header('From');
- my @from = Email::Address->parse($from);
- my $name = $from[0]->name;
- my $email = $from[0]->address;
- ($name, $email, $mime->header('Date'));
+ # newer Email::Simple allows header_raw, as does Email::MIME:
+ my @list_ids = $simple->can('header_raw') ?
+ $simple->header_raw('List-Id') :
+ $simple->header('List-Id');
+ my @dests;
+ for my $list_id (@list_ids) {
+ $list_id =~ /<[ \t]*(.+)?[ \t]*>/ or next;
+ if (my $ibx = $pi_cfg->lookup_list_id($1)) {
+ push @dests, $ibx;
+ }
+ }
+ if (scalar(@list_ids) > 1) {
+ warn "W: multiple List-IDs in message:\n";
+ warn "W: List-ID: $_\n" for @list_ids
+ }
+ \@dests;