);
close PASS;
$pop = Net::POP3->new('your.pop3.server.com', Timeout => 5);
$pop->user('username');
$count = $pop->pass($pass);
unless (defined $count)
{
return "(=H1 Error H1=)(=P There was an error contacting my mail server in under 5 seconds. Maybe it's dead. P=)";
}
$ret .= "Number of messages: $count
\n";
$ret .= "# | From | Subject | Date |
\n";
for (my $mi=1; $mi<=$count; $mi++)
{
my $lines = $pop->top($mi);
my %msg = {};
foreach my $l (@{$lines})
{
if ($l =~ /^(Subject|Date|From): (.+)$/)
{
$msg{lc($1)} = $2;
}
}
$msg{'from'} = &BMLUtil::ehtml($msg{'from'});
if ($msg{'from'} =~ /^\s*(.+) (\<.+)/)
{
my $fromname = $1;
my $email = $2;
$fromname =~ s/^\"//; $fromname =~ s/\"$//;
if ($fromname =~ /^=\?.+\?(.+)\?=$/)
{
$fromname = $1;
$fromname =~ s/=20/ /;
}
$email =~ s/^\<//; $email =~ s/\>$//;
$msg{'from'} = "$fromname
$email";
}
$msg{'subject'} = &BMLUtil::ehtml($msg{'subject'});
$msg{'date'} =~ s/(\d\d\:\d\d):\d\d.*/$1/;
my $shading = $mi % 2 ? "" : "BGCOLOR=#EEEEFF";
if ($msg{'from'} =~ /some_regular_expression_matching_private_messages/i)
{
$msg{'subject'} = "x x x x x x";
}
$ret .= "$mi | $msg{'from'} | $msg{'subject'} | $msg{'date'} |
\n";
}
$ret .= "
\n";
return $ret;
_CODE=)
<=BODY
PAGE=)