commit - 7124e2ee906e17ef9268b5a8074445ce750207f2
commit + 895156fd3e4fba0170813ea3a2d168af1505a5b1
blob - 5cb8fa667e9bfa2735b127675c356bc8562077f0
blob + 08f658b130d1ed0a7a22e33c3c7555cabe05f38c
--- mailread.pl
+++ mailread.pl
use IPC::Run3;
my $content = do { local $/; <> };
+my ($headers, $body) = split(/\n\n/, $content, 2);
my $ishtml = qr/< *(html|head|body|div|table|p|span|br) *\/?>/i;
my @links;
-run3(['lynx', '-dump', '-force_html', '-stdin'], \$content, \$content, undef) if ($content =~ $ishtml);
-$content =~ s{(https?://[^\s<>"]+)}{
+run3(['lynx', '-dump', '-force_html', '-stdin'], \$body, \$body, undef) if ($body =~ $ishtml);
+$body =~ s{(https?://[^\s<>"]+)}{
if (length($1) > 80) {
"[Link #" . (push @links, $1) . "]";
} else {
close $fh;
}
-print $content;
+print "$headers\n\n$body";