diff options
author | John Ankarström <john@ankarstrom.se> | 2021-05-27 19:25:28 +0200 |
---|---|---|
committer | John Ankarström <john@ankarstrom.se> | 2021-05-27 19:26:38 +0200 |
commit | 778853929562100fc111afa8a244111c24747e89 (patch) | |
tree | 13b3fd14a1b4db9e1896c011b62a6923c6ae097d | |
parent | 76042851b82d9471991440856182da4bff03be7f (diff) | |
download | mum-778853929562100fc111afa8a244111c24747e89.tar.gz |
Now, it handles From: headers split across multiple lines.
-rwxr-xr-x | src/m-pop | 13 |
1 files changed, 7 insertions, 6 deletions
@@ -87,17 +87,18 @@ for my $id (@ids) { chomp(@msg = @{$pop->get($id)}); } - # Make From_ line - my ($from, $from_alt); + # Find address in From: header and make From_ line + my $from; my $j = 0; # index of empty line before message body for (@msg) { last if /^$/; + if (/^[Ff]rom: / .. not $msg[$j+1] =~ /^[ \t]/) { + /^(?: From:\ | [ \t]+) (.*)/x; + $from .= " $1" if $1; + } $j++; - $from = $1 if /^From: (.*)$/; - $from_alt = $1 if /^from: (.*)$/; } - $from = $from_alt if $from_alt and not $from; - $from = $1 if $from and $from =~ /^.* <(.*?@.*?)>$/; + $from = $1 if $from and $from =~ /^.* <(.*?@.*?)>$/s; $from = 'MAILER-DAEMON@' . hostname if not $from; my $from_ = "From $from $date"; |