(=_INFO NOCACHE=>1 _INFO=)(=PAGE TITLE=>My Mail BODY<= (=_CODE use Net::POP3; my $ret = "(=H1 My Mail H1=)\n(=P \nJust for the hell of it, here's the current list of messages sitting in my Inbox. My Inbox is my to-do list... if there's a message here, it's because I haven't read it yet (very unlikely) or more likely, that it contains something which I have to take action on. The size of my inbox is almost directly proportional to my stress level. Under 20 messages is generally pretty good.\n P=)\n"; $ret .= "(=P How do you do this? People keep asking me how I do this. Here's the source. It's Perl, wrapped in BML. P=)"; open (PASS, "/path/to/some/password/file/outside/your/webroot.txt"); chomp ($pass = ); 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 .= "\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 .= "\n"; } $ret .= "
#FromSubjectDate
$mi$msg{'from'}$msg{'subject'}$msg{'date'}
\n"; return $ret; _CODE=) <=BODY PAGE=)